Expression Elements - trillium_discovery - trillium_quality - Latest

Trillium Control Center

Product type
Software
Portfolio
Verify
Product family
Trillium
Product
Trillium > Trillium Discovery
Version
Latest
Language
English
Product name
Trillium Quality and Discovery
Title
Trillium Control Center
Copyright
2024
First publish date
2008
Last updated
2024-10-18
Published on
2024-10-18T15:02:04.502478

There are five elements you use to build expression statements in any Expression Builder window:

  • Attributes. A list of attributes associated to the current entity. When you use the Expression Builder at the attribute level (for example, when creating or editing an attribute business rule), only the current attribute can be used in the expression.
  • Functions. There are various function types, including Numeric, String, and Transformation.
  • Literal expressions. There are two types of literal expressions: True and False. You can also use the literal datatypes "Decimal", "Integer", and "String" for simple datatype checks against the values you provide. For example, TYPE(attribute1) = "String"
  • Operators. There are five types of operators: Arithmetic, Comparison, Logical, Set, and String. Most of the operators are also provided as icons in the middle of the Expression Builder. Click an icon to add an operator to the expression text field.
  • Free-form data value text. These are literal values (usually a value contained in an attribute) that you manually enter into an expression; for example, "New York", "Wendell Ruiz", and "tomato." This text is case-sensitive; when you add these values into an expression, they must match exactly how the values read in the attribute.

Guidelines

When building expressions in the Expression Builder, note the following guidelines and best practices:

  • To improve the readability of your expressions, include the following formatting:
    • Parentheses
    • Carriage returns
    • Spaces
    • Tabs

For example, the expression LENGTH(Name) = 7 AND PATTERN(Name,"rich") LIKE "u-*" can be reformatted as follows: LENGTH(Name) = 7 AND PATTERN(Name,"rich") LIKE "u-*"

  • Use parentheses to determine precedence. For example:

1+2 * 3+4 = 11

(1+2) * (3+4) = 21

Also, when working with complicated expressions, as a best practice, surround the expression in parentheses to ensure expected results.

  • When creating long or complex expressions, consider breaking down and testing parts of the expression to verify they work as expected, and then add the parts into the more complex expression. Also, periodically copy and save the expression, or add the expression to the Business Rules Library. You may want to backtrack to the saved version or use it as a basis for another expression.
  • When building a comparison expression and you are unsure of the case of your data values (upper or lower), consider including the UPPER or LOWER function with your expression. For example, UPPER ([Shirt Color]) = "BLUE".
  • Consider including the TRIM function when you need to ensure there are no leading or trailing spaces that may affect expression results, such as with numeric values; for example, ISNUMERIC(TRIM(LPACK(value))).
  • Do not use attribute names that share function keywords; for example, Metaphone, Type, and Average. The Expression Builder will recognize these words as function keywords only. When necessary, change an attribute's name before using it in an business rule, conditional, or other type of expression.
  • As you build your expressions, the syntax is colorized as followed:
    • Operator keywords AND, ELSE, IF, IN, LIKE, NOT, OR, THEN in blue.
    • Strings and other values in double-quotes ("") in red.
    • Comments in green.
    • Literal numbers, attributes, and any other values in black.
  • You can add comments (displayed in green) to expressions in two ways:
    • For multi-line comments, add text between /* .... */.
    • For end-of-line comments, add text after a double-hyphen (--).