[Index]
The Macro Evaluator is available to test a macro at a hierarchy level. Refer to the macro functions, syntax and examples in the documentation.
Choose Administration Tools > Macro Evaluator to open the Macro Evaluator input form.
From the drop-down list, choose the Context Hierarchy at which the macro is to be evaluated.
Enter the macro text in the Macro input box.
By default, a macro {# data.Countries.* | country_name:input.country #} is entered as a test macro to evaluate and Show Context is enabled to display the Context Data box for the input. parameter in the macro. Refer to the examples in the macro reference topics.
Enable and provide values for Context Data and add data if required.
Click Evaluate to run the query. The result of the evaluated macro is displayed in the Output box.
Additional utility controls available on the Macro Evaluator form:
fn.evaluate: Evaluate the string using the macro interpreter.
The string can be a macro and can also contain macro names to be evaluated.
The purpose of the function is so that we can save data as a macro and then evaluate it when we read it again.
For example, we may store default values in a data model (e.g. SiteDefaultsDoc) that may also refer to existing macros. An attribute of the model - with name: defaulthppt can for example have the value (The macro evaluates to a site name):
Site-{{macro.SITENAME}}
Then, a workflow Configuration Template at a Site can be a set to a value that references the model and that uses fn.evaluate:
"defaulthppt": "{{ fn.evaluate data.SiteDefaultsDoc.defaulthppt }}",
Not:
"defaulthppt": "Site-{{macro.SITENAME}}",
The tables below provide further examples.
Where self.x specifies an attribute of a model, with the value:
{# data.Countries.iso_country_code | country_name:'South Africa' #}
Example | Output |
---|---|
Then: {# fn.evaluate self.x #} |
['ZAF'] |
Where MACRO1 is:
{{ data.Countries.emergency_access_prefix | iso_country_code:FRA }}
Where self.x is:
{# data.Countries.iso_country_code | emergency_access_prefix:macro.MACRO1 #}
Example | Output |
---|---|
Then: {# fn.evaluate self.x #} |
Codes with same prefix as FRA: ['DNK','HKG', 'FRA','DEU', 'IND','ITA', 'NLD','NZL', 'SAU','ESP', 'SWE','ZAF', 'CHE','TUR'] |
Title | Description | Details |
---|