Conditional Content script dialog

Conditional Content scripts can show or hide elements depending on certain conditions and values. They can be added by right-clicking any element in a template and clicking Make Conditional. If the current element has neither an ID nor a class, an ID will be automatically generated. See Showing content conditionally.

The general options in the Conditional Script wizard are:

  • Name: The name of the script, making it easier to identify it.

  • Selector: The Selector or Text to apply the result of the script to.

    • Selector: Uses CSS selectors to find the element to which the script applies.

    • Text: Uses text as a trigger for the script. The script applies to all instances of the text found in the template.

    • Selector and Text: Uses the specified selector as a trigger for the script. The script applies to all instances of the text found within the specified Selector.

    For more information about Selectors see Selectors in OL Connect.

  • Action: Use the drop-down to select whether to Show or Hide the element when the condition below is true. If, conversely, the condition evaluates to false, the opposite action will be performed.

A condition is made up of groups and rules.

The Add button adds a rule that evaluates a data field to a group.
To add either a group, or a rule that evaluates a runtime parameter, click the downward pointing arrow next to this button and select Group or Parameter Rule.

  • Group:

    A group consists of one or more rules with a logic operator. Four logic choices are available at the Group level. These are:

    • All of the following.
      This equates to the logical operator (... AND ...).
      If all of the associated criteria are met, then this group resolves to TRUE.

    • Any of the following.
      This equates to the logical operator (... OR ...).
      If any of the associated criteria are met, then this group resolves to TRUE.

    • Not all of the following.
      This equates to the logical operator (NOT(... AND ...)).
      If any (but not all) of the associated criteria are met, then this group resolves to TRUE.

    • Not any of the following.
      This equates to the logical operator (NOT (... OR ...)).
      If none of the associated criteria are met, then this group resolves to TRUE.

  • Rule:

    • Data Field / Parameter: Use the drop-down to select which data field in the record, or which runtime parameter in the template, the condition will be based upon. (See Runtime parameters.)

    • Operator: Select which kind of comparison is applied.

      The options available will depend upon the Data Field or Parameter type (they are "type aware"), but most have at least "is equal to" and "is not equal to" as an option.

    • Value: The value(s) used for the conditional check.

      • String data field specific selections are whether the alphanumeric string "is empty" or "is not empty", or "contains", "does not contain", "starts with" or "ends with" another string value.
        Values are case sensitive by default. You can click the button next to the value to make them case insensitive, which means that upper- and lowercase letters are treated as being the same.

      • Date data field specific selections are whether the date field is "before" or "after" another date entry.
        Dates should be entered in ISO standard notation (yyyy-mm-dd) (see ISO 8601). It is best to select the date using the date selection option.

      • Boolean data field specific selections are whether the selected Boolean data field "is true" or "is false".

      • Numeric data field specific selections: Whether the numeric fields is "less than", "less than or equal to", "greater than" or "greater than or equal to" another number entry.

The script is displayed below the condition and updated while the condition is being edited.