SetVarListFromFile constructs a list of variables from the content of a csv or excel file.
File columns are mapped to variables using SetParam sub-actions (see below SetParam attributes table).

Tag Attributes

Attribute Name

Attribute Value

ListName

Name of list Required

FilePath

Input file path. Supported extensions are CSV, XLS and XLSX. - Required

SkipRows

Number of rows to skip on top.
E.g.:

  • SkipRows="0" (default) -> reads from the 1st line

  • SkipRows="2" (default) -> reads from the 3rd line

SkipValue

Input value that allows row skipping.
If a row contains it, the whole row is skipped.

Unique

TRUE - Only keep unique variable sets
"Any variable name" - Only keep sets with unique value for this variable

OrderAscBy

Variable Name on which to order ascending (cannot be combined with OrderDescBy)

OrderDescBy

Variable Name on which to order descending (cannot be combined with OrderAscBy)

Map columns to variables

One SetParam represents one mapping.


SetParam attributes

Name

Value

Field

Variable Name to map to

Value

Column index to map from (starting from 0)

Example script

<ytriaAutomation>
	<!-- Read C:\InputFile.xlsx file and create a list named MyList.
		Ignore the file's first line.
		Skip lines that contain "-n/s-".
		Keep unique values in column "eMail" (ignore rows that create duplicates).
		Order the list ascending by "displayName"
	 -->
	<SetVarListFromFile FilePath="C:\InputFile.xlsx" ListName="MyList" skipRows="1" skipValue="-n/s-" Unique="eMail" OrderAscBy="displayName">
		<SetParam field='objectType' value='0'/> <!-- Reads column #0 into objectType list var -->
		<SetParam field='displayName' value='3'/> <!-- Reads column #3 into displayName list var -->
		<SetParam field='eMail' value='11'/> <!-- Reads column #11 into eMail list var -->
	</SetVarListFromFile>
	
	<!-- Display list content -->
	<Loop list="MyList">
		<ExecuteListAction/>
		<Echo value="objectType: {%objectType%}, displayName: {%displayName%}, eMail: {%eMail%}"/>
	</Loop>
</ytriaAutomation>
XML