Professional > Table scripting > Table specification syntax > Special elements > Creating an element based on a custom expression
 
Creating an element based on a custom expression
Sample Script File: SpecialElements.mrs
This example script is based on the Museum sample data set. See Running the sample table scripts for information on running the example scripts.
biology{.., ^Not_answered, expression('visits > 4')}
This example creates an axis based on the biology variable. It includes all of the elements in the axis with the exception of the Not answered category, but has an additional element, which is based on a custom expression. The custom expression selects respondents who entered a value greater than 4 when answering the question on which the visits variable is based. Because we have not specified a label for the special element, the label defaults to the expression text.
Just like when you specify a custom label, you must enclose the custom expression in single quotation marks ('<expression>') or two double quotation marks (""<expression>""). If the expression contains a text literal, you must escape the double quotation marks used to enclose the text literal as you do when a label contains a double quotation mark. For example, if you use single quotation marks, you must escape each of the double quotation marks that enclose the text literal with a second double quotation mark.
Here is a table that has this axis on the top:
You can use any expression that is supported by the Data Model, including any of the functions in the UNICOM Intelligence Function Library.
See also
Special elements