Link Search Menu Expand Document

set

The action set is used to add a new (or update) value for a variable.

Specification

Arguments

 TypeRequired?Vars supported? 
valuestringyesyes
arrayIndexnumericnoyes
descriptionstringnono
whilebooleannoyes
whenbooleannoyes
countnumericnoyes

value ( any | required ) : Expression to be evaluated.

Example 1: Basic use of argument section

set firstname{
  value = Jhon
}
// value of variable firstname is John

Example 2: Complex variables

set countryName {
    value = "spain"
}
set john{
  value = {
    firstname = John
    lastname = Doe
    country = toUppercase(countryName)
  }
}
// john.firstname is John, john.lastname is Doe and country is SPAIN

arrayIndex ( numeric | optional ) : If variable is an array, we can modify it partially.

Example 1: Basic use of argument section

set heroes {
  value = [{firstname=Laika},{firstname=Valto}]
}

set heroes{
  arrayIndex=1
  value = {
     firstname = Balto
  }
}
// value of heroes is [{firstname=Laika},{firstname=Balto}]

description ( string | optional ) It is used to apply descriptive text to the action.

Example 1: Basic use of argument

set firstname{
  description = "it firstname of the person to be created"
  value = John
}

when ( bool | optional ) It is used to control if the action must be executed.

var {
  evalJobStatus = false
}

set firstname{
  value = John
  when = evalJobStatus
}

count ( number || optional ) It determines the number of times the action is executed. Additionally, the variable _.index is increased in each iteration. The value of _.index starts with 0 and it ends with count-1.

Example 1: Basic use of the argument

set counter {
  value = _.index
  count = 3
}
// After this statement the value of variable counter will be 2

while ( boolean | optional ) The action is executed repeatedly as long as the value of this argument is met. Additionally, the variable _.index is increased in each iteration. The value of _.index starts with 0 and increase in 1 in each iteration.

Example 1: Basic use of argument while

set counter {
  value = _.index
  while = _.index<=2
}