Table of Contents

Search

  1. Preface
  2. Mappings
  3. Parameters
  4. CLAIRE recommendations
  5. Data catalog discovery
  6. Visio templates

Mappings

Mappings

Expression macros in Visio templates

Expression macros in Visio templates

Expression macros are macros that can help create flexible expressions in Visio templates. You can use expression macros in Expression and Aggregator objects.
Use an expression macro to specify repetitive expression statements or complex expressions. Expression macros apply a common expression pattern across a set of fields, such as adding all or a set of fields together, checking if fields contain null values, or converting dates to a different format.
You can use an expression macro to generate output fields and variable fields.
An expression macro consists of several parts:
  • Macro variable declaration. When you declare the macro variable, you declare the macro variable name and the fields to be used in the macro expression. Use the link rule format to declare the fields. As with link rules, you can list actual field names or use a link rule, such as All Ports or Pattern.
    Use the following syntax for the macro variable declaration:
    Macro variable declaration element
    Description
    Syntax
    Macro variable name
    Macro variable name. Use a logical name.
    Declare_%<macro variable name>%
    Macro variable fields
    Fields to be used in the macro expression.
    You can list field names, create an expression to define the field names, or use a link rule.
    For example, you can use the following syntax to apply a macro across all fields in the object:
    {"port":"All Ports"}
    When listing field names, use a comma delimited list.
    You can create more than one set of variable fields as follows:
    {"<variable1>"}:"value1, value2..."}, "<variable2>":"value1, value2..."}
    When you use a variable in an expression, enclose the variable name in percent signs, as follows:
    %<macro variable field name>%
    {"<macro variable field name>":"<macro variable field list, expression, or rule>" }
  • Macro statement. When you define the macro statement, you define the names of the macro output field names and the macro expression.
    Macro statement element
    Description
    Output field names
    Expression that defines the field names for the output fields generated by the expression macro.
    You can use variables and rules to help define output field names, such as <%field%>_out.
    Macro expression
    Expression to be used.
For example, you might use the following expression macro to check if any of the address fields that start with "addr" are null. The ISNULL output port will be set to a value 1 or higher if one or more fields are null:
Macro variable name: Declare_%addressports% Macro variable fields: {"addrport":"Pattern:^addr"} Output field names: ISNULL Macro expression: %OPR_SUM[IIF(ISNULL(%addrport%),1,0)]%