In this article
This functionality enables you to create simple scripts by selecting functions from lists. The scripts are then assembled automatically by Reportal.
Note: The code used in standard filters and TGL filters is not interchangeable; you cannot use the TGL language in a standard filter expression or standard filter code in a TGL filter. However, you can use either type of filter to do the same job, and you can use both types of filter in the same report.
Creating a New Filter Expression
- In the Filters toolbox, right-click on the Filters object and select Insert Filter Expression from the menu.
- In the Filters toolbox, right-click on the New Filter Expression object and select Rename from the menu.
- Type into the field a logical name for the object.
- Click out of the field to close the text editor.
- Double click on the New Filter Expression object or right-click on it and select Edit, to open the Filter Expression Designer page .
A New Filter Expression object is created in the Filters toolbox.
The object name becomes a text editing field.
Figure 1 - Example of the Filter Expression Designer page
This page is where you create the filter expression that is the overall filter for the users. You can select criteria from the list and assemble them using the operators and functions, or if you have the required knowledge you can write the expression directly into the data field (go to Reportal-Specific Functions in Filter and Segment Expressions for more information).
Note: To use the Mailing Status, Mailing Status Date or Emails Sent objects, the underlying project will need a respondent list uploaded and emails will have to have been sent.
Note: You can also select the required answers from the questions in the Data Source by holding down the Ctrl key on your keyboard whilst clicking on the required answers. Then right-click in one of the selected answers and select New Filter Expression from the drop-down menu.
Setting up a Filter Expression
- In the left column, search for or browse to the question you wish to start your expression with, and click on it to select it.
- Click on the required Value/Parameter to select it.
- Select the radio button for the None operator (you cannot start an expression with the operators And or Or), and check the NOT box if required.
- Select the appropriate function and type any text or values into the Text or Number fields as required.
- Click Add Here (see the following figure) to add the criteria to the field .
- Select and add criteria until you have the required expression.
- Click Save to save the changes.
The Values or Parameters (depending on the option selected) that apply to the question will be listed in the second column. Note that you can select hierarchical variables here; in this case the nodes will be listed in the second column. Expand the levels as necessary to find the node you wish to use for the filter.
Figure 2 - Adding criteria to the data field
Note that the coding is displayed in the white text field and the expression is “written” below the field in full with colors to denote the functions.
The expression in the example here will show Males between the ages of 31 and 50 who have indicated that they have test-driven one or more of the three cars (Toyota, Ford or BMW).
Figure 3 - Example of a complete expression
If you type in your expression “manually” (go to Reportal-Specific Functions in Filter and Segment Expressions for more information), click Validate to run an automatic validation check for the expression.
Designer Data Fields
- Project – the projects selected for the report are listed here. Click the down-arrow and select from the list the project you wish to use.
- Loop – if the project includes loops, these are listed here. Click the down-arrow and select from the list the loop you wish to use.
- Search – in the event the report contains many questions, use the Search facility to find the question you are interested in. type a character or string of characters into the Search field. As you type, Forsta Plus reduces the question list to show only those questions that include that character or series somewhere in the question name.
- Values – if the answers to the selected question have specific values that you wish to use in the filter (for example, Male or Female), select the Values radio button to list the value options of the selected question.
- Parameters – if the filter is to vary depending on selections made by the user, then the filter will need to use parameters. Select this radio button to list the parameters that have been created for the report.
- Date – when the selected question contains date data, this field will be accessible.
- The Operators:
- And – a conjunction operator to be used when more than one criteria must be satisfied. For example, the panelist must be male and must be married.
- Or – a conjunction operator to be used when one or more criteria must be satisfied. For example, the panelist must have network access from home or from work.
- None – this is not a conjunction operator. Use when adding the first criteria in the expression.
- Not – the negative operator. Use for example when you want panelists who are not in banking though any other profession is acceptable.
- The Functions (these will be active depending on the criteria selected):
- Equal – use when you want the selected criteria to be equal to a specific value, for example when you want panelists of a specific age or you want the criteria to be Yes or No.
- In – use when the criteria value is to be one of a range or set of values.
- Between – use when you want the criteria to be between two values, for example between two dates.
- > (Greater than) - use when the criteria is to be greater than a specified value.
- >= (Greater than or equal to) - use when the criteria is to be greater than or equal to a specified value.
- < (Less than) – use when the criteria is to be less than a specified value.
- <= (Less than or equal to) – use when the criteria is to be less than or equal to a specified value.
- Any– use if the filter is to return TRUE if any (one or more) of the selected values is found.
- All – use if the filter is to return TRUE only if all the selected values are found.
- IsNull - use if the filter is to return TRUE if the question is not answered.
- Other data fields:
- Text area – type text as required into this field. The field is only accessible for certain pre-defined criteria.
- Paste area – here you can paste in, for example, a list of values copied from a document.
- Number – here you can type in numerical characters only. Use in conjunction with a Function (see above) when, for example, you want a criteria to have a specific numerical value. The field is only accessible for certain pre-defined criteria.
- End Number – when the Number field is open, if you also select the Between function, a second numerical data field appears. This enables you to input a second number such that you can specify the criteria must have a value between the two given numbers.