In this article
- In the Data Source toolbox, right-click on the Segment folder and select Insert Segment Expression (Inside) .
- Double-click the new segment or right-click on it and select Edit.
- In the Data Source toolbox, right-click on the segment 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.
Figure 1 - Adding a Segment Expression
A new segment object is created in the Segments folder.
The Segment Expression Designer that opens is similar to the Filter Expression Designer
Figure 2 - Example of the Segment Expression Designer page
This page is where you create the segment expression. 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: 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 Segment Expression from the drop-down menu.
To change the name of the new segment object:
The object name becomes a text editing field.
Example
Say for example that we wish to show females between the ages of 31 and 50 who have selected the BMW as their favorite car and who earn $75000 or more.
- 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 - in this case the Gender question.
- Click on the required Value/Parameter to select it - here Female.
- 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 .
- For this example you will now need to add code 3 (31-50) of the q4 Age question using the AND operator, code 6 (BMW) of the q7 Favorite question also using AND, and finally we have asked for q9 Salary to be "greater than or equal to 75000".
- Click Save to save the changes.
The Values or Parameters (depending on the question selected) that apply to the question will be listed in the second column.
Figure 3 - Adding criteria to the data field
Note that the coding is displayed in the white data field while the logical expression is “written” below the field in full.
The resulting expression is shown in the example here .
Figure 4 - Example of a complete expression
If you type in your expression “manually”, click Validate to run an automatic validation check for the expression (go to Reportal-Specific Functions in Filter and Segment Expressions for more information).
Designer Data Fields
- Loop Levels – 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 – 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.
- Contains – you can write an expression that looks, for example, for a certain combination of four characters anywhere in a line of text.
- Left – you can write an expression that looks, for example, for the first three characters in a line of text. In this case select Left as the desired string is to be on the left end of the line.
- Right – you can write an expression that looks, for example, for the last three characters in a line of text. In this case select Right as the desired string is to be on the right end of the line.
- 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.
- 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.