Skip to main content
Skip table of contents

SetVarListFromGridSelection: Create a list of variables from the grid selection

Tag: SetVarListFromGridSelection

The SetVarListFromGridSelection creates lists of variables from the values in the selected rows.

XML
<SetVarListFromGridSelection/>

Tag Attributes

ListName

List name - Required

TargetGrid target name - Required according to context (like any other grid action)
(variable names)Any unreserved name is valid in XML. Reserved names are listed here: Variables
(Variable Values)

Valid grid column IDs.

e,g,  v_ID='id'
If the 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.

or

$PK$ to assign the grid Primary Key of the row to the variable value

or

A Javascript formula enclosed in double brackets,

e.g. v_JS='[[var a=&quot;#*CSV3*#.#*CSV4*#&quot;.split(&quot;.&quot;); a]]'

Where/WhereAlternate

Unique ID of the column that's used as a filter. The field value in this column is tested against the value set in (where mode).
See the example below with OBJECTTYPE column used as a WHERE clause.

NOTE 1: WhereAlternate will use the underlying 'alternate value' (always an integer) that exists in some columns as sapio365's 'OBJECTTYPE' or 'STATUS' columns.
<Select Lines="ByValue">
<SetVarListFromGridSelection v_ID='id' ListName='list_COUNT' where='OBJECTTYPE' Equals='Message'/>


NOTE 2: if the field in the WHERE column is a multivalue, it is exploded and set as OK if it passes the WHERE test for at least one of its values.

(Where Mode)

Text:
Equals
Begins
NotBegins
NotEquals
Contains
NotContains
IsInString
IsNotInString
Ends
NotEnds
IsIn (colon separated list)
IsNotIn (colon separated list)

GreaterThan
GreaterOrEquals
LessThan
LessOrEquals


Number:
GreaterThan
GreaterOrEquals
LessThan
LessOrEquals

Date/Time:
not supported - workaround by comparing ISO8601 strings of date values

Examples:
Begins="abcd"
IsIn ="abcd:efgh" true if the value returned by where is "efgh" but false if "ef"
IsInString ="abcdefgh" true if the value returned by where is "cd" but false if "dc"

UniqueTrue: Only keep unique variable sets
"Any variable name": Only keep sets with a unique value for this variable
OrderAscByVariable Name on which to order ascendingly (cannot be combined with OrderDescBy)
OrderDescByVariable Name on which to order descendingly (cannot be combined with OrderAscBy)
UseAlternateValueSemicolon Separated ColumnID list: For columns in this list, the value in the output list will be the underlying 'alternate value' (always an integer) that exists in some columns as sapio365's 'OBJECTTYPE' or 'STATUS' columns.
RawFormatTrue: Use raw (unformatted) value (otherwise display-formatted value is used)
ExplodeColumnIDUnique ID of column whose multivakues must be exploded during the making of the list
ForceUTC

True: date/time from the grid are shifted to their UTC values before being set in the list.

NB: date/time grid values and formats are not altered.

Verbose

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

Defaults o FALSE

Detailed Description

The variable can be referenced in the script after its declaration with SetVar. To reference a variable, enclose it in: {% and: %}. Variable names are not case-sensitive.

Example Script

XML
<ytriaAutomation Application="sapio365">
	<!-- to be launched from a groups view with a selection of rows -->
	<!-- Generate a List of SetVar from the current selection in the grid:
	- Set list name and target grid (target is not needed in sapio365 or main grids in Notes products)
	- Add variable names connected to grid column unique IDs (GCVD penultimate column) to store grid values into
	In this example "displayName", "groupType", "createdDateTime", "mailEnabled" are column unique IDs from the sapio365 Groups grid:-->

	<SetVarListFromGridSelection ListName="GroupList" GroupName="displayName" Type="groupType" Kreator="createdDateTime" Mail="mailEnabled" OrderAscBy="GroupName"/>
	<!-- loop on the generated list -->
	<loop list="GroupList">
		<ExecuteListAction/> <!-- Does a <SetVar/> with the attributes in SetVarListFromGridSelection except 'ListName' and 'Target' -->
		<echo value="Group {%GroupName%} is of type {%Type%} and was created on {%Kreator%} (mail enabled: {%Mail%})"/>
	</loop>
</ytriaAutomation>
XML
<ytriaAutomation>
    <SetVarListFromGridSelection ListName="GroupList" GroupPK="$PK$" where='OBJECTTYPE' Equals='Group'/>
    <!-- loop on the generated list -->
    <loop list="GroupList">
        <ExecuteListAction/>
        <echo value="Group PK is {%GroupPK%}"/>
    </loop>
    <Unselect/>
    <SelectFromList ListName="GroupList">
        <SetParam columnID="$PK$" value="GroupPK"/>
    </SelectFromList>
</ytriaAutomation>

automation-tree-SetVarListFromGridSelection-1

Example with multivalue explosions :

XML
<ytriaAutomation>

    <SetVarListFromGridSelection ListName="UserList" UserPK="$PK$" license="ASSIGNEDLICENSESNAME" ExplodeColumnID="ASSIGNEDLICENSESNAME" UName="displayName" where='OBJECTTYPE' NotEquals='Guest'/>
    <!-- loop on the generated list -->
    <loop list="UserList">
        <ExecuteListAction/>
        <echo value="User {%UName%} PK {%UserPK%} License is {%license%}"/>
    </loop>

</ytriaAutomation>
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.