Tag: SetVarFromListValue

The SetVarFromListValue function automates the action of creating a variable (like SetVar) from a value in the list.

Tag Attributes

Variable Name

Any unreserved name valid in XML

Reserved names are:

Date: current date MM/DD/YYYY
Time: HH:MM;SS AM/PM

Loop context:
LoopIndex: current loop index
ListSize: current list size
ListName: current list name

FolderDocuments: Windows account Documents folder path (%USERPROFILE%\Documents)


FolderTemp: Ytria temp folder path (%LOCALAPPDATA%/Ytria)

ErrorAction
ErrorSystem

Variable Valuename of the parameter in the list to get the value from
WhereName of list entry parameter to test
Filter ModeeOne of:

Text filters:
Equals
Begins
NotBegins
NotEquals
Contains
NotContains
Ends
NotEnds

Number filters:
GreaterThan
GreaterOrEquals
LessThan
LessOrEquals

Example: Begins="abcd"

Detailed Description

All parameters are mandatory:

<SetVarFromListValue ListName="MyList" MyNewVar1="ParamNameFromMyListEntry" MyNewVar2="OtherParamNameFromMyListEntry"Where="YetAnotherParamNameFromMyListEntry" equals="xyz"/>
XML


The first action in the list (according to order in the XML script) that matches the WHERE filter value sets the new variable(s). In the following example, the new variables MyNewVar1 and MyNewVar2are respectively set to YellowandBlack:


<list name="ListOfVar2" action="Setvar" v1="Yellow" v2="Black" Number="43"/>/>
<list name="ListOfVar2" action="Setvar" v1="Red" v2="Blue" Number="3500"/>
<SetVarFromListValue ListName="ListOfVar2" MyNewVar1="v1" MyNewVar2="v2" Where="Number" GreaterThan="1"/>
XML


Example Script

<ytriaAutomation>
	<list name="ListOfVar" action="Setvar" v1="mugre" v2="chaise"/>
	<list name="ListOfVar" action="Setvar" v3="Roger" v4="Zer"/>
	<list name="ListOfVar" action="Setvar" v1="A" v2="B"/>
	<list name="ListOfVar" action="Setvar" v1="C" v2="D"/>
	<list name="ListOfVar" action="Setvar" v11="OK" v12="SAD" v3="Teeth" v4="Claw"/>
	<list name="ListOfVar" action="Setvar" v1="help" v2="pleh" v3="admin@OverHere.com" v4="www.ytria.com"/>
	<list name="ListOfVar" action="Setvar" v1="dog" v2="Leech" v3="Roger" v4="Zer"/>		
	<SetVarFromListValue ListName="ListOfVar" MyNewVar1="v3" MyNewVar2="v4" Where="v1" equals="dog"/>
	<SetVarFromListValue ListName="ListOfVar" MyNewVar3="v3" MyNewVar4="v4" Where="v1" equals="crocodile"/><!-- no param value march in list for v1 -->
	<SetVarFromListValue ListName="ListOfVar" MyNewVar5="VarDoesNotExist" Where="v1" notEquals="crocodile"/><!-- no param name march at all for VarDoesNotExist -->
	<list name="ListOfVar2" action="Setvar" v1="Red" v2="Blue" Number="42"/>
	<list name="ListOfVar2" action="Setvar" v1="Yellow" v2="Black" Number="999"/>/>
	<SetVarFromListValue ListName="ListOfVar2" MyNewVar6="v1" MyNewVar7="v2" Where="Number" GreaterThan="666"/>
	<echo value="MyNewVar1={%MyNewVar1%}"/>
	<echo value="MyNewVar2={%MyNewVar2%}"/>
	<echo value="MyNewVar3={%MyNewVar3%}"/>
	<echo value="MyNewVar4={%MyNewVar4%}"/>
	<echo value="MyNewVar5={%MyNewVar5%}"/>
	<echo value="MyNewVar6={%MyNewVar6%}"/>
</ytriaAutomation>
XML