Apply Filtering to Data Destinations

In TrueContext, you can set up multiple Data DestinationsClosed 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:

Essentials
Advanced
Enterprise

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:

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:

  1. Link multiple Data Destinations to a single form, and set up filter rules for each destination.
  2. For some types of destinations, you can use Data Reference Expression Language (DRELClosed 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 DestinationClosed 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.

2019-06-06-Filtering01.png

Form Version State

2019-06-06-Filtering02.png

Form Submission Workflow State

The Submission Workflow State filter in a Data Desintation. "Completed" is selected by default.

Select submission workflow states that execute the Data Destination. You can select more than one option.

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 SectionClosed 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 statusClosed 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.

Data Destination filter settings that show the input expression %a[url_box] and a filter expression where the backslash character \ escapes the forward slashes and period in the URL. The second input expression is %r[workflowStatus] with a filter expression in which the backslash character escapes the opening and closing parentheses.

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 SourceClosed 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*$