It is sometimes necessary to modify data before mapping the data. In EvOps, Liquid Markup Language is used for reformatting, reconstructing, and changing data based on logic before providing it as input.
There are three main features of the Liquid markup language; Objects, Tags, and Filters.
Objects
Objects are data variables that are populated by users' properties, prompts, and workflow activity output. These objects are wrapped in double curly brace delimiters {{ }}
, and look like this:
{{userInput.promptResourceGroup.name}}
In the above example, userInput
indicates that its prompt output data, promptResourceGroup
, is the prompt id. These combined is the object, name
is a property of that object. Each object has a list of associated properties.
Tags
Tags are used to create logic and control flow for mappings. The curly brace percentage delimiters {% %}
and the text that they surround does not produce any visible output. This lets you assign variables and create conditions.
For example, you can map different data depending on prompt selections:
{% if {{userInput.purpose.value}} == 'Prd' %}
{{userInput.classification.value}}
{% else %}
None
{% endif %}
If the userInput.purpose.value
is not equal to Prd, then the output will be:
None
The above example uses if
and else
tags, which are control flow tags.
Liquid tags are categorized into various types. Se links below for more examples:
Filters
Filters are used to modify the output of numbers, strings, objects, and variables. They are placed within an output tag {{ }}
, and are denoted by a pipe character |
.
An example is the capitalize
string filter:
{{ userInput.firstname.value | capitalize}}
Above filter modifies the string object by changing the first character to uppercase.
Multiple filters can be used on one output, and they are applied from left to right:
{{ userInput.firstname.value | downcase | capitalize }}
Above filter modifies the entire string object to lowercase and after that changes first character to uppercase.
See this link for all String filters that can be used to manipulate outputs of string type:
String Filter Reference Link
TIP: You can also use verify your code in the online editor here.
Comments
0 comments
Article is closed for comments.