Apply Filtering to Data Destinations
In TrueContext, you can set up multiple Data Destinations A Data Destination specifies where to send data from a submitted form. You can use Data Destinations to automate data sharing and storage, routing data to a specific service (such as email or cloud storage) in several different formats. for a single form. This automates data sharing and storage, and ensures that the right people or systems get the information they need. Filter Rules control when a destination actually sends data. For example, you can create a rule so only inspection data marked as “Electrical” is sent to an electrical contractor. Similarly, HVAC-related answers are routed to an HVAC contractor using a different destination. This topic describes how to set up different types of filter rules.
Available on all tiers:
Contents
How Filter Rules work
When destinations send data (execute)
With Filter Rules set up, destinations execute only when the rule conditions are met. The rules can be based on:
- Answers to one or more questions.
- Whether the form is Archived, Active, or Draft.
- The workflow state.
Data routing
You can set up multiple Data Destinations for a single form to send data to different people or systems. For example, after inspection, HVAC issues go to an HVAC contractor, electrical findings to an electrician, and structural concerns to an engineer.
In addition to sending data to people, you can automatically route information to different systems, such as:
- Updating records in Salesforce.
- Storing documents in SharePoint.
- Triggering notifications through email or SMS.
To route different subsets of data to different people or systems, use a combination of filter rules and data mapping features:
- Link multiple Data Destinations to a single form, and set up filter rules for each destination.
- For some types of destinations, you can use Data Reference Expression Language (DREL
Data Reference Expression Language (DREL) is used to get form data and metadata and add it to a string, such as dates, usernames, or answers to questions in forms.) to define which answers are included in the data sent out.
This approach ensures that each team or system receives only the relevant information they need, automating workflows and reducing manual effort.
Filtering Options
To access the filtering options, first create the Data Destination A Data Destination specifies where to send data from a submitted form. You can use Data Destinations to automate data sharing and storage, routing data to a specific service (such as email or cloud storage) in several different formats., and then go to the Filtering tab.
Note:The Data Destination will only execute if the record meets all filter conditions set up on this page.
Form Version State
- Filtering can be based on the state of the form (Active, Draft or Archived) the data record is submitted against.
- For example, the Draft
A draft form is a partially filled-out form saved on a device, or a preliminary version of a form that's been saved but not deployed in the Form Builder. version of an “Inventory” form might have data submitted against it for testing purposes only. To avoid routing the testing data to the same location as production data, clear the Draft option to exclude Draft forms.
- You can select multiple options to include more than one Form Version State.
Form Submission Workflow State
Select submission workflow states that execute the Data Destination. You can select more than one option.
- Select Completed to execute the Data Destination when a mobile user submits a completed record. If the form requires approval, the destination executes after a supervisor approves the record, which changes the record state to completed. (Enterprise tier only). Completed is selected by default.
- Select Cancelled to execute the Data Destination when a mobile user declines a dispatch. You might set up a destination with this filter to create a notification for the dispatcher.
- Select Incomplete to execute the Data Destination when a mobile user submits an incomplete TrueContext Teamwork
TrueContext Teamwork is an Enterprise tier feature that enables mobile users to transfer incomplete forms for other users to complete as part of a multi-user workflow. This can be useful for jobs that require someone else's expertise or that span multiple shifts.-enabled form (Enterprise tier only).
- You can select multiple options to include more than one Submission Workflow State
The workflow state describes the current stage in a workflow as a result of the last action taken on a record. For example, a record might have the workflow state "Dispatched"..
Custom Filter Rules
Custom filter rules provide the most advanced and flexible way to control data routing for submitted records. You can use filter rules to match a specific response to a form question, such as routing records based on a “Pass” or “Fail” result. You can also use Data Reference Expression Language (DREL) to reference other types of data or metadata, like user names or submission dates. The filter checks if a specified string or pattern exists, using regular expressions for matching options. If the filter rules result in matching records, the destination executes.
-
Match All/Match Any:
- If you select All, all filter rules must be true for the Data Destination to execute.
- If you select Any, at least one rule must be true for the Data Destination to execute.
Note:The Match All/Match Any setting only applies to custom filter rules, not to the Form Version State or Form Submission Workflow State settings. Even with Match Any selected for the custom filter rules, the submitted record must still match the selected form version and workflow state filters.
-
Input Expression: This tells the filter the data to match. The filter can check a question response, a form name, or a submitter name, for example. Use Data Reference Expression Language (DREL) to set up the Input Expression.
-
Filter Expression: This specifies the string to match and must be a Regular Expression. The section Custom Filter Rule Examples shows examples of different types of matching.
Info:When you configure a Data Destination as Repeatable, you can create custom Row Filter Rules for individual rows of 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.. This enables you to control which rows the destination sends. The topic Create Filter Rules for Individual Rows in a Repeatable Destination explains Row Filters in more detail.
Using Special Characters in Custom Filter Rules
If using a Filter Expression with static text that has reserved characters used in regular expressions, you must escape them using a backslash (\).
The following example shows how to escape special characters for URL and workflow status The workflow status describes how a record moves through your company’s workflow. All statuses include a workflow state, and some also contain the data flow state or completion result. values.
This example shows a regular expression that allows for variations in the workflow status. The regular expression ^Completed(\s+\([^)]+\))?$
matches on Completed
and Completed (any_value)
, such as Completed (Approved)
.
Custom Filter Rule Examples
All of the following examples are based on the same hypothetical “Inspection” form, where a site is given a final rating. When a user submits a record, an Email Data Destination filters the results. This setup ensures that the regional manager is only sent an email if the site doesn’t pass the inspection.
Simple match
If the site fails the inspection, the question with the unique ID Rating has a value of Fail
.
Match Contains | Exact Match |
Enter the string to match. This example matches any string that contains “Fail”, such as Fail, Failed, Failing, or No Fail. | The Filter Expression ^Fail$ matches only the value “Fail”, not Failed, Failing, or No Fail. |
![]() |
![]() |
Note:When you set up an exact match filter rule, remember that the filter string must exactly match. The string is case sensitive and includes whitespace. We recommend that you only use exact match filter rules for options-based questions or questions that are auto-populated by a Data Source Data sources, also known as "Lookups", are external sources of data that you upload or connect to TrueContext. You can reference this data in a form to populate answers or answer options. Data sources save typing, reduce errors, and make it easy to provide mobile users with only the relevant, most current data..
Alternation (Or)
In the following filter rule, the destination executes if the site receives a rating of Poor or Fail. The pipe (|) functions as an “or” operator in the Filter Expression Poor|Fail. As always, the Filter Expression is case sensitive.
Range
This Filter Expression is based on a rating scale of 1-9. The data destination executes if the site receives a rating of 1, 2, 3, or 4.
Tip:The destination also executes if the rating is 10, because the 1 matches the filter expression. If you want to match only when the entire field is exactly 1, 2, 3, or 4 (and not 10 or any other value), use the expression ^[1-4]$. This pattern ensures that only a single character (1, 2, 3, or 4) matches, and nothing else.
Answered or Not answered
- If you want the destination to execute only if the question is answered, use the expression ^(?!\s*$).+
- If you want the destination to execute only if the question is not answered, use the expression ^\s*$