0

Dynamically read all population tokens from a word template to build dynamic form in PowerApps

Hi all, 

I was wondering if it would be possible to get an action, especially for Power Apps, that reads all tokens used in a selected document. 

My idea is to have a "dynamic form" based on the tokens used in a template. We could parse the content of a template document into that action, the action then checks all <<[tokens]>> and returns an array/table of the token name and its data type. That table can then be used to build a gallery inside the app to input data without having to build the form.

That action could require lets say to specify what data type the token is by using the Expression Formatting Syntax.  A string wouldnt have anything, a number the # and zeros and a date would have a format. If no format is specified in the template, the action would return the data type string.

Thanks!

3 comments

  • Avatar
    Jay Goodison Official comment

    Hello Robert Heep

    Thank you for the detailed request; 

    I understand the technical use case but wondered whether there was an easier option to determine which template you were going to use? Each template would have a specific JSON schema, which you would also need to store... i.e. you need both and therefor would need to be able to transform the data provided by the form into the relevant JSON schema. Considering you could simply base the dynamic form on the selected JSON schema? 

    Edited by Jay Goodison
  • 0
    Avatar
    Robert Heep

    Jay Goodison Thanks for your answer. Not sure if I understand you 100%, but the more I think about it, the more complicated it gets. Because you will have to transform the token output into a valid inputs that can be used in formulas.

    My idea was simply to have any document easily transformed to an input form. I would only need to add the tokens to the document and the input form is magically created.

  • 0
    Avatar
    Jay Goodison

    Robert Heep - perhaps this may help, if not lets arrange to discuss via teams? 

    To populate a Word document you need the following?

    1) A template (containing pre-configured with tokens)

    2) A JSON dataset - with the schema matching the template

    Typically, you'd build a template and the JSON data structure together, or you may even just start with the JSON dataset (We're just about to release a Word add-in which builds the template... user friendly template creation).

    Given this, crafting a dynamic form based on the tokens contained within a document is one approach... I was simply suggesting using the JSON schema is probably an easier / more standard solution to base your dynamic PowerApps forms? 

Please sign in to leave a comment.