Macro Syntax Brackets#

Macros can have any of the following markup:

  • {{ and }}

    indicate macros that resolve to single values. The value can also return an object. A direction parameter is also available for hierarchy searching. This is indicated by ||. Refer to the topic on SELECT-FROM-WHERE type macros for details.

    Any number of single opening and closing brackets ({ and }) can also occur inside these scalar macros.

  • {# and #}

    indicate macros that resolve to lists of values.

  • {% and %}

    indicate macros that resolve to dictionaries

  • (( and ))

    indicate macros that test for a condition are enclosed in round brackets (( and )) - these macros evaluate to True or False

    The comparison operators that are available for these macros are: ==, !=, <, >, <=, >=.

    The ‘SELECT FROM WHERE’ operator can be used in a test is |, for example:

    (( data.User.username | username:John == 'John' )) <true> <false>
    

    See also ‘SELECT FROM WHERE’-type macros below.

    It is highly recommended to use named macros for things in this case, in other words, instead of:

    (( data.User.username | username:John == 'John' )) <true> <false>
    

    use:

    MY_USER = {{ data.User.username | username:input.username }}
    (( macro.MY_USER == input.username )) <true> <false>
    

    The WHERE clause can also contain a logical AND, represented by a comma (,), for example:

    (( device.cucm.Line.pattern | pattern:pwf.PassedLine.pattern, routePartitionName:pwf.PassedLine.routePartitionName == '' ))
    

    Similarly, the test condition can contain a logical AND, for example:

    (( fn.list_contain macro.GS_CLIMaskANANumberType_MCR,macro.GS_CLIMaskANAGetAllowedTypes_MCR == true ))
    
  • ((test)) <if value> <else value>

    IF ELSE type conditional macro.

  • ((test)) <value> ((test)) <value> <value>

    IF ELSEIF ELSE-type macros combine tests and result values if the test resolves to True or False. The logic is IF (test) THEN <value> ELSE IF (test) THEN <value> ELSE <value>.

    Example:

    ((self.a == self.b)) <foo-{{CallManager.host}}>
     ((self.b ==  self.c)) <foo-{{CallManager.username}}>
     <foo-{{CallManager.version}}>
    

    This macro tests for the equality of values in a calling model (referenced by ‘self’) and returns an evaluation for the condition that is True. The evaluation refers in dot notation to attributes of a Data Model called ‘CallManager’ and concatenates the result with a string ‘foo-‘.

  • ‘SELECT FROM WHERE’-type macros returning single-, dictionary- and list type values and can take parameters.

    The format is:

    • {{ SELECT FROM | WHERE }}

    • {% SELECT FROM | WHERE %}

    • {# SELECT FROM | WHERE #}

    These types and their parameters are illustrated in the topic on ‘SELECT FROM WHERE’ Macros: SELECT FROM WHERE Macro Syntax.