SetVarListsFromGridColumns: Create a list of variables from the unique values in grid columns

Tag: SetVarListsFromGridColumns

The SetVarListsFromGridColumns function creates lists of variables from the unique values in the grid column.


XML
<SetVarListsFromGridColumns/>

Tag Attributes

Attributes

Value Description

Target

Grid target name - Mandatory according to context (like any other grid action) - Required

The Target may also be an action to open another module (e.g. ShowUsers).

In that case, the module opens and the selection is made in that grid. Then the module closes.

Variable names

Any unreserved name valid in XML. Reserved names are listed on: Variables.

Variable values

Valid grid column IDs. If a column is not found (invalid column ID), an error is raised, the action fails,

the list ends up empty and the loop will do nothing.

Explode

true/false

Verbose

When set to TRUE, displays a console trace for each element added to the list

Defaults to TRUE



As of 2021/08/06, when EXPLODE is not used or FALSE, multivalue fields are set as NON-WRAPPED text (no number of multivalues etc.) in the automation list, unlike in the Values grid filter: a,b,c, not: [3] a,b,c

Example Script

XML
<ytriaAutomation Application="sapio365">
	<SetVarListsFromGridColumns target="ShowUsers" cities="city" positions="jobTitle"/><!-- make lists of cities and job titles from a user module that will be temporarily opened-->
		<UserInput Title="Select city and position">
			<Variable name="City" Label="Select city" Tooltip="The unique cities from ShowUsers" Type="List">
			<ListItem ListName="cities" value="cities"/>
			</Variable>
			<Variable name="Position" Label="Select position" Tooltip="The unique positions from ShowUsers" Type="List">
			<ListItem ListName="positions" value="positions"/>
			</Variable>
		</UserInput>
		<MsgBox Title="Selection made" Message="City is {%City%}" MessageExtended="Position is {%Position%}" Type="eXclamation"/>
</ytriaAutomation>


In this example, two lists of the unique values from a Users module that will be opened are created from the columns city and jobTitle. The two lists are then used to populate two dropdowns in a UserInput dialog.
The users module opens in order to gather the data and closes automatically when the lists are ready.


XML
<ytriaAutomation Application="sapio365">
	<ShowUsers>
		<SetVarListsFromGridColumns cities="city" positions="jobTitle"/><!-- make lists of cities and job titles from current user module-->
			<UserInput Title="Select city and position">
				<Variable name="City" Label="Select city" Tooltip="The unique cities from ShowUsers" Type="List">
					<ListItem ListName="cities" value="cities"/>
				</Variable>
				<Variable name="Position" Label="Select position" Tooltip="The unique positions from ShowUsers" Type="List">
					<ListItem ListName="positions" value="positions"/>
				</Variable>
			</UserInput>
		<MsgBox Title="Selection made" Message="City is {%City%}" MessageExtended="Position is {%Position%}" Type="eXclamation"/>
	</ShowUsers>
</ytriaAutomation>



In this example, two lists of the unique values from the current Users module are created from the columns city and jobTitle.


automation-tree-SetVarListsFromGridColumns-1.gif

automation-tree-SetVarListsFromGridColumns-2.gif


Example Script: EXPLODE

XML
<ytriaAutomation Application="sapio365" console="false">
	<ShowUsers>
		<SetVarListsFromGridColumns licenses="ASSIGNEDLICENSENAMES" Explode="true"/>
			<UserInput Title="Select licenses">
				<Variable name="License" Label="Select license" Tooltip="The unique Licenses from ShowUsers" Type="List">
				<ListItem ListName="licenses" value="licenses"/>
				</Variable>
			</UserInput>
		<MsgBox Title="Selection made" Message="Selected license is {%License%}" Type="eXclamation"/>
	</ShowUsers>
</ytriaAutomation>