AddEntry: add an entry to elements in a list
Tag: AddEntry
The AddEntry function adds an entry to each element in a list, or to a subset of these elements.
Detailed Description
An entry is the name of a list action parameter in a list element.
For example, in <List Name=”List1” Action=”SetVar” v1=”A” v2=”B”/>:
Name and Action are not list action parameters, they are mandatory settings of the List action
v1 and v2 are action parameters: they relate to “SetVar“; they are considered list entries in the element defined by the List action
An entry can be added to all elements in the list, or to a subset of elements defined by a WHERE clause that tests entry values.
For example, list A contains 10 elements with entries A. An entry B can be added to all elements, or only to elements that match a WHERE clause that compares entry values in each element to its settings.
If AddEntry targets existing entries, they are overwritten: AddEntry can be used to modify the existing entry values in a list.
The WHERE clause is case insensitive.
Tag Attributes
Attributes | Value Description |
|---|---|
ListName | Any string to ID the origin list (required) |
EntryName | Any string to ID the entry (required) |
EntryValue | The value to of the entry (not required) If not supplied, an empty entry is added When enclosed between [[ and ]], the value is interpreted as a Javascript formula. |
Where | Name of parameter to use for a source list subset selection (optional) |
(where comparison mode) | If the Where attribute is used, a comparison mode is required, one of:
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<ytriaAutomation>
<SplitIntoSetVarList ListName="List1" separator=":" var1="A:B:C:D:E:F" var2="a:b:c:d:e:f"/>
Add var3 with value X to all elements
<AddEntry ListName="List1" EntryName="var3" EntryValue="X"/>
<Loop list="List1">
<ExecuteListAction/>
</Loop>
Add var4 with value Y + Z to elements that have a var2 value different from a
<AddEntry ListName="List1" EntryName="var4" EntryValue="Y + Z" Where="var2" notequals="a"/>
<Loop list="List1">
<ExecuteListAction/>
</Loop>
Modify var2 to EDITED for elements that have a var4 value equal to Y + Z
<AddEntry ListName="List1" EntryName="var2" EntryValue="EDITED" Where="var4" equals="Y + Z"/>
<Loop list="List1">
<ExecuteListAction/>
</Loop>
</ytriaAutomation>

Combining values from the list:
EntryValue may contain references to the variables in the list (for list entries whereAction is set to SetVar: Action='SetVar').
For each list entry, current variables values are available:
<ytriaAutomation>
<List Name='ListA' Action='SetVar' vA='1' vB='2'/>
<List Name='ListA' Action='SetVar' vA='660' vB='6'/>
<List Name='ListA' Action='SetVar' vA='C' vB='B'/>
I want to combine vA and vB to create vC
<AddEntry ListName='ListA' EntryName='vC' EntryValue='{%vA%} + {%vB%}'/>
<Loop List='ListA'>
<ExecuteListAction/>
<echo Value='vC={%vC%}'/>
</Loop>
</ytriaAutomation>

Using a Javascript formula:
<ytriaAutomation>
<List Name='ListA' Action='SetVar' vA='1' vB='2'/>
<List Name='ListA' Action='SetVar' vA='660' vB='6'/>
<List Name='ListA' Action='SetVar' vA='C' vB='B'/>
JAVASCRIPT FORMULA:
<AddEntry ListName='ListA' EntryName='vC' EntryValue='[[{%vA%} + {%vB%}]]'/>
<Loop List='ListA'>
<ExecuteListAction/>
<echo Value='vC={%vC%}'/>
</Loop>
</ytriaAutomation>
If the evaluated formula triggers a JS error, the variable is assigned the error text:
