Configure the Router Setup Property
The Router Setup property enables you to parse and push data from a Text Field, Text Area, File Upload, or Barcode Scanner question to target questions in your form. This topic provides step-by-step instructions to configure the Router Setup property using Index, Regex, JMESPath, or XPath options.
Available on the Intelligent and Elite tiers:
Contents
Prerequisites
-
You must be an Admin user or a user with Can Create FormSpace
FormSpaces are where forms are stored and organized in the TrueContext Web Portal. A TrueContext Team may have multiple FormSpaces, depending on their needs. Admins can set FormSpace permissions to control which users have access to the forms in that FormSpace. permissions. -
You must have a working knowledge of regular expressions (regex) or index values. To route data from a JSON or XML file in a File Upload question, you need a working knowledge of JMESPath
JMESPath is a query language for JSON that's used to extract and filter data from JSON content. or XPath instead.Note:TrueContext Support can help with general questions but cannot help you to write regex.
-
Use the supported question types for source and target questions.
-
Make sure the target questions (the questions you want to populate with substrings) appear after the source question (the question that captures the initial string) in your form.
Tip:If you don’t have target questions set up in your form already, you can create them when you configure the Router Setup property.
Limitations
The following Router Setup property limitations apply to repeatable and template-based sections:
- A source question in a regular section
A Regular Section is a set of related questions grouped together for easy reference. The data captured is “non-repeating”. That is, field users enter a single instance of each answer. can’t route data to a repeatable or template-based section, except for questions in the footer. - A source question in a repeatable section
A Repeatable Section is a subform that contains a set of related questions. The data captured is “repeating”, because the field user can complete the same subform more than once, which creates multiple entries. can only route data to target questions within the same repeatable section. - A source question in a nested repeatable section can only route data to target questions within the same nested repeatable section.
- A source question in the footer of a repeatable or template-based section can’t route data to any question in the form.
- A source question in a template-based section can’t route data to any question in the form.
Steps to configure a Router Setup property
-
From the Forms & Integrations menu, navigate to the form you want to set up.
-
Select Edit Form.
-
Select or create the question that captures the initial string (the source question). You can choose any of the supported question types:
-
Text Field
-
Text Area
-
File Upload (JSON, XML, and text files)
-
Barcode Scanner
-
-
On the Properties tab, switch on the Router Setup.
Result: The system displays the extraction methods in Extract answers with. File Upload questions offer Index, Regex, JMESPath, and XPath. Other question types offer Index and Regex.
-
Select the type of routing. For a JSON file in a File Upload question, select JMESPath. For an XML file, select XPath. For text files and other question types, select Index or Regex.
-
Use a regular expression (regex) to search for values in a longer string and store them in capture groups (also known as capturing groups).
- Use index values to identify substrings based on their position in the longer string.
- Use a JMESPath expression to select values from a JSON file in a File Upload question.
- Use an XPath expression to select values from an XML file in a File Upload question.
Info:- The topics How regex works and How index values work provide more details about the Router Setup options.
- JMESPath is a case-sensitive query language for JSON. For a complete reference, go to the JMESPath documentation.
- XPath is a case-sensitive query language for selecting parts of an XML document. For a complete reference, go to the XPath documentation.
-
-
The steps to add an expression and map the results to target questions depend on the type of routing.
-
Index
-
Select or create the target questions to populate.
-
Enter the Range Start and Range End values for each target question.
-
-
Regex
-
Select Add an Expression.
You can add up to 10 expressions per question.
-
Enter the Regular Expression.
-
Select or create the target questions to populate.
-
Map the capture groups to the target questions.
-
-
JMESPath or XPath (File Upload only)
-
In Question to populate, select or create a target question.
-
Enter the JMESPath Expression or XPath Expression that selects the value for that question.
-
Repeat steps 1 and 2 for each target question.
-
Tip:-
The list of target questions contains subsequent, unmapped questions in your form.
-
To create a new question, just type a new question name and then select the Enter key. The Form Builder creates a new Text Field question using the standard default settings. You can edit this question later, after you save the source question.
-
-
Select Save.
Result: The system saves your question and any new questions that you created in step 6.
Tip:In this example, the target questions are configured as read-only, which means that users can’t change the routed (pushed) values.
-
Did you create a new question as part of the Router Setup configuration?
-
If yes, remember to edit the question if you want to change the default settings.
-
If no, remember to save and deploy the form.
-
Note:Test your form on all device platforms to ensure that the form behaves as expected.