Link Search Menu Expand Document

call

The action call is used to invoke defined functions.

Specification

Arguments

 TypeRequired?Vars supported? 
asstringnono
descriptionstringnono
whilebooleannoyes
whenbooleannoyes
countnumericnoyes

as ( string | optional ) The name of the variable used to persist the output of the invoked function.

Example 1: Basic use of argument

call listPeople{
  as = people
}

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

Example 1: Basic use of argument

call createPerson{
  description = "it invokes function createPerson"
}

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

var {
  mustCreatePerson = false
}

call createPerson{
  when = mustCreatePerson
}

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

call createPerson{
  with {
    id = "user_${_.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

call createPerson{
  with {
    id = "user_${_.index}"
  }
  while = _.index<=2
}

Blocks

A function could require arguments. The arguments are provided within a block with.

call createPerson {
    with {
        firstname = user.firstname
        role = "ADMIN"
    }
}