Actions

Actions #

This section lists and documents most actions available in Varv.

Reference: A full list of actions can also be found in the Reference. The reference might also contain more actions, that are currently in development and which specification might change in the future.

Concept Actions #

"clone" Action #

An action that clones pies a concept instance including all its properties.

Parameters:

Parameter Required Default Description
"of" Yes - The concept that should be cloned.
"deep" - false Specifies whether the clone should be deep, i.e., also clone referenced concept instances.
"as" - clone Specifies the name of the output variable.

Properties:

Properties Description
Shorthand Parameter "of"
Output Variable Type concept
Context Mode For-Each
Changes Context No

Examples:

Clones the currently selected target concept instance deeply:

{
    "clone": {
        "of": "$target",
        "deep": true,
        "as": "myOutputVariableName"
    }
}

Clones a concept instance stored in a variable shallow (shorthand version):

{ "clone": "$myConceptVariable" }

"count" Action #

An action that counts how many instances of a given concept exist.

Parameters:

Parameter Required Default Description
"concept" Yes - The concept that should be counted.
"where" - - Allows for filtering (see "where" action).
"as" - count Specifies the name of the output variable.

Properties:

Properties Description
Shorthand Parameter "concept"
Output Variable Type number
Context Mode For-Each
Changes Context No

Examples:

Counts how many "myConcept" that matches the given “where” filter, and saves the result as "myOutputVariableName":

{
    "count": {
        "concept": "myConcept",
        "where": {
            "property": "myProperty",
            "equals": "myTestValue"
        },
        "as": "myOutputVariableName"
    }
}

Counts how many "myConcept" there is, and saves the result as "count" (shorthand version):

{ "count": "myConcept" }

"exists" Action #

An action to check whether instances of a concept exist.

Parameters:

Parameter Required Default Description
"concept" Yes - The concept that should be checked if it exists.
"where" - - Allows for filtering (see "where" action).
"as" - exists Specifies the name of the output variable.

Properties:

Properties Description
Shorthand Parameter "concept"
Output Variable Type boolean
Context Mode For-Each
Changes Context No

Examples:

Sets a variable "myOutputVariableName" to true/false depending on if any "myConcept" that matches the where filter exists:

{
    "exists": {
        "concept": "myConcept",
        "where": {
            "property": "myProperty",
            "equals": "myTestValue"
        },
        "as": "myOutputVariableName"
    }
}

Sets a variable "exists" to true/false depending on if any "myConcept" exists (shorthand version):

{ "exists": "myConcept" }

"getType" Action #

An action to check the type of a concept instance, property, or variable.

Parameters:

Parameter Required Default Description
"property" Yes or "variable" or "target" - The property of which the type should be retrieved.
"variable" Yes or "property" or "target" - The variable of which the type should be retrieved.
"target" Yes or "property" or "variable" - The concept instance of which the type should be retrieved.
"as" - getType Specifies the name of the output variable.

Properties:

Properties Description
Shorthand Parameter "target"
Output Variable Type string
Context Mode For-Each
Changes Context No

Examples:

Retrieves the type of a property:

{
    "getType": {
        "property": "myProperty",
        "as": "myPropertyType"
    }
}

Retrieves the type of a target concept instance with the given UUID:

{
    "getType": {
        "target": "someConceptUUID",
        "as": "myConceptType"
    }
}

Retrieves the type of a target concept instance and puts it in the variable getType (shorthand version). Looks up in the following order: ContextConcept, LocalConcept, GlobalConcept, Variable, UUID.

{ "getType": "somePropertyNameVariableNameOrConceptUUID" }

Shorthand that looks up the current event target’s concept type:

"getType"

"new" Action #

An action to create new instances of concepts.

Parameters:

Parameter Required Default Description
"concept" Yes - The concept an instance should be created from.
"with" - - Allows to set properties of the new concept instance.
"select" - true Defines whether the newly created instance should be selected.
"forEach" - false If activated, the action will run once for each currently selected concept instance.
"as" - new Specifies the name of the output variable.

Properties:

Properties Description
Shorthand Parameter "concept"
Output Variable Type concept
Context Mode Depends on the "forEach" parameter
Changes Context If "select" is true, changes to the newly created instance.

Examples:

Creates a new instance but does not change the current selection, which means that the newly created instance is only passed along as a variable:

{
    "new": {
        "concept": "myConcept",
        "with": {
            "myFirstProperty": "someValue",
            "mySecondProperty": false,
            "myThirdProperty": "$myVariableName"
        },
        "as": "myVariableName",
        "select": false
    }
}

"remove" Action #

Removes one or multiple concept instances.

Parameters:

Parameter Required Default Description
"target" - - The concept, which should be deleted. Can be either a reference to an instance or an array (Default: the current target in the context).

Properties:

Properties Description
Shorthand Parameter "target"
Output Variable Type None
Context Mode For-Each
Changes Context Yes, if the current target gets removed.

Examples:

Removes the current context target:

{ "remove" }

Remove the concept or concepts (if variable points to an array) that the variable holds:

{ "remove": "$someVariable" }

"select" Action #

An action to select concept instances. It is possible to select concept instances from a concept type, a property, a specific instance, or a variable.

Parameters:

Parameter Required Default Description
"concept" Yes or "property" or "target" - The concept type from which instances should be selected.
"property" Yes or "concept" or "target" - Selects the concept instances of a concept property or an array of concepts.
"target" Yes or "concept" or "property" - The UUID or an array of UUIDs of specific concept instances to select.
"where" - - Filtering of concept instances using the same filtering as the "where" action.
"forEach" - false If activated, the selection will run once for each currently selected concept instance.
"stopIfEmpty" - false If activated, the action does not forward an empty event if the selection is empty.
"as" - - Specifies the name of the output variable. The output variable is only set if this parameter is added.

Properties:

Properties Description
Shorthand Parameter "concept"
Output Variable Type array of concept (if the "as" parameter is set)
Context Mode Depends on the "forEach" parameter
Changes Context Yes

Examples:

Select all concept instances of a given concept type:

{ "select": { "concept": "myConceptType" }}

Select all concept instances of a given concept type (shorthand version):

{ "select": "myConceptType" }

Select all concept instances of a given concept type and save the selected UUIDs in a variable:

{
    "select": {
        "concept": "myConceptType",
        "as": "mySelection"
    }
}

Select a concept instance with given UUID:

{ "select": { "target": "concept57b18d140f8709bf4b74" }}

Select a concept instance saved in a variable (shorthand version):

{ "select": "$myConceptVariable" }

Select all concept instances of a given concept type, filtering for some property:

{
    "select": {
        "concept": "myConceptType",
        "where": {
            "property": "color",
            "equals": "yellow"
        }
    }
}

"sort" Action #

An action that sorts concept instances in a selection based on a property or variable in either ascending or descending order. Only properties and variables with primitive types (string, number, or boolean) can be used for sorting.

Parameters:

Parameter Required Default Description
"property" Yes or "variable" - The property of concept instances that is used for ordering.
"variable" Yes or "property" - The variable of a context that is used for ordering.
"order" - "asc" Selects whether the sorting order should be ascending (asc) or descending (desc).

Properties:

Properties Description
Shorthand Parameter "property"
Output Variable Type None
Context Mode Bulk
Changes Context Yes

Examples:

A simple example of ordering the concept instances of a selection ascending by a property:

{
    "sort": {
        "property": "myProperty",
        "order": "asc"
    }
}

A simple example of ordering the concept instances of a selection descending by a variable in the context:

{
    "sort": {
        "variable": "myVariable",
        "order": "desc"
    }
}

Shorthand example that sorts ascending using a property:

{ "sort": "myProperty" }

"where" Action #

An action to filter the current selection to a set of conditions. Conditions can be nested and connected using and, or, and not.

Parameters:

Parameter Required Default Description
"property" Yes or "variable" or "calculate" - A property that should be compared with a value.
"variable" Yes or "property" or "calculate" - A variable that should be compared with a value.
"calculate" Yes or "property" or "variable" - A calculation which result should be compared with a value. See the "calculate" action for more information on calculations.
"stopIfEmpty" - false If activated, the action does not forward an empty event if the selection becomes empty.

In addition, the below value and composition operators can be used.

Value Operators:

Operator Useable for Property Types
"equals" boolean, number, string, concept
"unequals" boolean, number, string, concept
"greaterThan" number, string
"lessThan" number, string
"greaterOrEquals" number, string
"lessOrEquals" number, string
"startsWith" string
"endsWith" string
"includes" string, array
"matches" string

Composition Operators:

Operator Description
"and" Combines an array of conditions in which all conditions have to be met.
"or" Combines an array of conditions in which at least one conditions has to be met.
"not" Negates a condition.

Properties:

Properties Description
Shorthand Parameter None
Output Variable Type None
Context Mode Bulk
Changes Context Yes

Examples:

Simple example of a single condition comparing a property with a value:

{
    "where": {
        "property": "myProperty",
        "equals": 5
    }
}

An example of comparing a variable in a negation:

{
    "where": {
        "not": {
            "variable": "myVariable",
            "startsWith": "Hello "
        }
    }
}

An example using a calculation and a variable:

{
    "where": {
        "calculate": "10 + $myVariable$",
        "lessThan": 17
    }
}

An example using an and composition:

{
    "where": {
        "and": [
            {
                "calculate": "10 + $myVariable$",
                "lessThan": 17
            },
            {
                "property": "myProperty",
                "endsWith": "!!!"
            }
        ]
    }
}

An example with multiple compositions and conditions:

{
    "where": {
        "or": [
            {
                "calculate": "10 + $myVariable$",
                "equals": 15
            },
            {
                "not": {
                    "variable": "myVariableName",
                    "equals": "myVariableValue"
                }
            },
            {
                "not": {
                    "property": "myProperty",
                    "equals": "myPropertyValue"
                }
            },
            {
                "and": [
                    {
                        "property": "myOtherProperty",
                        "unequals": "somethingelse"
                    },
                    {
                        "property": "myThirdProperty",
                        "lessThan": 10
                    }
                ]
            }
        ]
    }
}

Context Actions #

"limit" Action #

An action to limit the current selection to a given number of targets starting from first or last.

Parameters:

Parameter Required Default Description
"count" Yes - The number of targets that should remain in the selection.
"last" - false An option whether the given count of elements should be the first or last ones in the selection.

Properties:

Properties Description
Shorthand Parameter "count"
Output Variable Type None
Context Mode Bulk
Changes Context Yes

Examples:

Limit targets to 1, starting from first:

{
    "limit": {
        "count": 1,
        "last": false
    }
}

Limit targets to 1, starting from first (shorthand version):

{ "limit": 1 }

Limit targets to 2, starting from last:

{
    "limit": {
        "count": 2,
        "last": true
    }
}

"storeSelection" Action #

An action that stores all targets in an event in an array variable.

Parameters:

Parameter Required Default Description
"as" - storeSelection Specifies the name of the output variable.

Properties:

Properties Description
Shorthand Parameter "as"
Output Variable Type array of concept
Context Mode Bulk
Changes Context No

Examples:

Stores the current array of targets in a variable.

{ "storeSelection": { "as": "mySelectionVariableName" }}

Shorthand version:

{ "storeSelection": "mySelectionVariableName" }

Property Actions #

"eval" Action #

An action that takes a condition (like in the "where" action) and evaluates it to a Boolean variable.

Parameters:

Parameter Required Default Description
"property" Yes or "variable" or "calculate" - A property that should be compared with a value.
"variable" Yes or "property" or "calculate" - A variable that should be compared with a value.
"calculate" Yes or "property" or "variable" - A calculation which result should be compared with a value. See the "calculate" action for more information on calculations.
"as" - eval Specifies the name of the output variable.

Value and Composition Operators:

See "where" action.

Properties:

Properties Description
Shorthand Parameter None
Output Variable Type boolean
Context Mode For-Each
Changes Context No

Examples:

A simple example:

{
    "eval": {
        "property": "myBooleanProperty",
        "equals": false
    }
}

A simple example using a composition:

{
    "eval": {
        "and": [
            { "property": "myBooleanProperty", "equals": false },
            { "property": "myNumberProperty", "lessThan": 10 }
        ]
    }
}

"get" Action #

An action that stores a property value in a variable.

Parameters:

Parameter Required Default Description
"property" Yes - The name of the property of the current target or a property using the dot notation.
"as" - get Specifies the name of the output variable.

Properties:

Properties Description
Shorthand Parameter "property"
Output Variable Type Type of the property
Context Mode For-Each
Changes Context No

Examples:

Gets the given property and stores it in a variable.

{
    "get": {
        "property": "myProperty",
        "as": "myVariableName"
    }
}

Shorthand version:

{ "get": "myProperty" }

Get a property on a currently not selected concept:

{
    "get": {
        "property": "myConcept.myProperty",
        "as": "myVariableName"
    }
}

"set" Action #

An action to set a property or variable to a given value.

Parameters:

Parameter Required Default Description
"property" Yes or "variable" - The name of the property of the current target or a property using the dot notation.
"variable" Yes or "property" - The name of a variable.
"value" Yes - The value it should be set to.

Properties:

Properties Description
Shorthand Parameter "property" or "variable", and "value"
Output Variable Type None
Context Mode For-Each
Changes Context No

Examples:

Set property to a given value:

{
    "set": {
        "property": "myProperty",
        "value": "myValueToSet"
    }
}

Set property to a given value (shorthand version):

{ "set": { "myProperty": "myValueToSet" }}

Set a variable to a given value:

{
    "set": {
        "variable": "myVariableName",
        "value": "myValueToSet"
    }
}

Set variable to a given value (shorthand version using the $-notation):

{ "set": { "$myVariableName": "myValueToSet" }}

Set a property on a currently not selected concept to a given value:

{
    "set": {
        "property": "myConcept.myProperty",
        "value": "myValueToSet"
    }
}

"length" Action #

An action that returns the length of a string or an array into a variable.

Parameters:

Parameter Required Default Description
"of" > "property" Yes or "variable" - The string or array property to get the length from.
"of" > "variable" Yes or "property" - The string or array variable to get the length from.
"as" - length Specifies the name of the output variable.

Properties:

Properties Description
Shorthand Parameter "of"
Output Variable Type number
Context Mode For-Each
Changes Context No

Examples:

Get the length of a property:

{
    "length": {
        "of": { "property": "myArrayOrStringProperty" },
        "as": "myOutputVariableName"
    }
}

Get the length of a property on a not selected property:

{
    "length": {
        "of": { "property": "myConcept.myArrayOrStringProperty" },
        "as": "myOutputVariableName"
    }
}

Get the length of a property (shorthand version):

{ "length": "myProperty" }

Get the length of a variable:

{
    "length": {
        "of": {"variable": "myArrayOrStringVariable"},
        "as": "myOutputVariableName"
    }
}

Get the length of a variable (shorthand version):

{ "length": "$myVariable" }

Boolean Actions #

"toggle" Action #

An action to toggle a Boolean property or variable.

Parameters:

Parameter Required Default Description
"property" Yes or "variable" - The property that should be toggled.
"variable" Yes or "property" - The variable that should be toggled.

Properties:

Properties Description
Shorthand Parameter "property" or "variable"
Output Variable Type None
Context Mode For-Each
Changes Context None

Examples:

Toggle a Boolean property:

{ "toggle": {  "property": "myBooleanProperty" }}

Toggle a Boolean property on a non-selected concept:

{ "toggle": { "property": "myConcept.myBooleanProperty" }}

Toggle a Boolean property (shorthand version):

{ "toggle": "myBooleanProperty" }

Toggle a Boolean variable:

{ "toggle": { "variable": "myBooleanVariable" }}

Toggle a Boolean variable (shorthand version):

{ "toggle": "$myBooleanVariable" }

String Actions #

"concat" Action #

An action that concatenates an array of strings and stores the result in a variable. It is also possible to use properties and variables.

Parameters:

Parameter Required Default Description
"strings" Yes - The array of strings that should be concatenated.
"as" - concat Specifies the name of the output variable.

Properties:

Properties Description
Shorthand Parameter "strings"
Output Variable Type string
Context Mode For-Each
Changes Context No

Examples:

Simple example:

{
    "concat": {
         "strings": [ "How", "dy!" ],
         "as": "myOutputVariableName"
    }
}

Shorthand version:

{ "concat": [  "Hello",  " ", "World!" ] }

Using an string array variable:

{
    "concat": {
         "strings": "$myStringArrayVariable",
         "as": "myOutputVariableName"
    }
}

Using properties and variables in the array:

{
    "concat": {
         "strings": [
             "Variable: "
             {"variable": "myStringVariable"},
             " Property: ",
             {"property": "myStringProperty"}
         ],
         "as": "myOutputVariableName"
    }
}

Using a string variable shorthand inside the array:

{
    "concat": {
         "strings": [ "Hello, ", "$myStringVariable", " doing?" ],
         "as": "myOutputVariableName"
    }
}

"enums" Action #

An action that returns the possible enum options of a string property as an string array.

Parameters:

Parameter Required Default Description
"property" Yes - The string property to get the enum options for.
"as" - enums Specifies the name of the output variable.

Properties:

Properties Description
Shorthand Parameter "property"
Output Variable Type array of string
Context Mode For-Each
Changes Context No

Examples:

Simple example:

{
    "enums": {
        "property": "myEnumProperty",
        "as": "myVariableName"
    }
}

Example for using the dot notation to get properties of not selected concepts:

{ "enums": { "property": "myConcept.myEnumProperty" }}

Shorthand version:

{ "enums": "myEnumProperty" }

"split" Action #

An action to split up a string property or variable into an string array using a given delimiter.

Parameters:

Parameter Required Default Description
"property" Yes or "variable" - The string property to split up.
"variable" Yes or "property" - The string variable to split up.
"delimiter" - , The delimiter used for splitting the string.
"as" - split Specifies the name of the output variable.

Properties:

Properties Description
Shorthand Parameter "property" or "variable"
Output Variable Type array of string
Context Mode For-Each
Changes Context No

Examples:

Simple example with a property:

{
    "split": {
        "property": "myStringProperty",
        "delimiter": ";",
        "as": "myResultArrayVariable"
    }
}

Simple example with a variable:

{
    "split": {
        "variable": "myStringVariable",
        "delimiter": ";",
        "as": "myResultArrayVariable"
    }
}

Shorthand version with a property:

{ "split": "myStringProperty" }

Shorthand version with a variable:

{ "split": "$myStringVariable" }

"textTransform" Action #

An action to transform string to upper or lower case or to capitalization.

Parameters:

Parameter Required Default Description
"property" Yes or "variable" - The string property to transform.
"variable" Yes or "property" - The string variable to transform.
"mode" Yes - Specifies the name of the output variable (uppercase, lowercase or capitalize).
"as" - textTransform Specifies the name of the output variable.

Properties:

Properties Description
Shorthand Parameter None
Output Variable Type string
Context Mode For-Each
Changes Context No

Examples:

Uppercase a string in a property:

{
    "textTransform": {
        "property": "myStringProperty",
        "mode": "uppercase"
    }
}

Capitalize a string in a variable:

{
    "textTransform": {
        "variable": "myStringVariable",
        "mode": "capitalize"
    }
}

Number Actions #

"calculate" Action #

An Action that calculates a given math expression and stores the result in a number variable. The calculate action uses math.js to calculate, see its documentation for detailed use. Variables can be used within expressions using the $-notation.

Like in math.js, it is possible to use multi-line expressions either using the ; in a single expression or by splitting lines into elements of an array (see examples). Multi-line expressions in Varv, however, can only return a single value, not an array.

Parameters:

Parameter Required Default Description
"expression" Yes - The math expression that should be calculated. Variables can be enclosed in $ signs. This can be an array that is joined as a multi-line expression.
"as" - calculate Specifies the name of the output variable.

Properties:

Properties Description
Shorthand Parameter "expression"
Output Variable Type number
Context Mode For-Each
Changes Context No

Examples:

Simple example:

{
    "calculate": {
        "expression": "sqrt(2) * sqrt(2)",
        "as": "myOutputVariableName"
    }
}

Shorthand version with using a variable in the expression:

{ "calculate": "42 + 60 + $myVariableName$ + 10" }

A multi-line expression example:

{ "calculate": "a = 3; b = 4; a + b" }

A multi-line expression as an array of expressions (results in the same expression as the previous example):

{
    "calculate": [
        "a = 3",
        "b = 4",
        "a + b"
    ]
}

"decrement" Action #

An action to decrement number properties or variables.

Parameters:

Parameter Required Default Description
"property" Yes or "variable" - The property to decrement.
"variable" Yes or "property" - The variable to decrement.
"by" - 1 The amount by which it should be decremented.

Properties:

Properties Description
Shorthand Parameter "property"
Output Variable Type None
Context Mode For-Each
Changes Context None

Examples:

Decrement a property by 1:

{ "decrement": { "property": "myNumberProperty" }}

Decrement a property by 2:

{
    "decrement": {
        "property": "myNumberProperty",
        "by": 2
    }
}

Decrement a property by 1 (shorthand version):

{ "decrement": "myNumberProperty" }

Decrement a variable by 2:

{
    "decrement": {
        "variable": "myNumberVariable",
        "by": 2
    }
}

"increment" Action #

An action to increment number properties or variables.

Parameters:

Parameter Required Default Description
"property" Yes or "variable" - The property to increment.
"variable" Yes or "property" - The variable to increment.
"by" - 1 The amount by which it should be incremented.

Properties:

Properties Description
Shorthand Parameter "property"
Output Variable Type None
Context Mode For-Each
Changes Context None

Examples:

Increment a property by 1:

{ "increment": { "property": "myNumberProperty" }}

Increment a property by 2:

{
    "increment": {
        "property": "myNumberProperty",
        "by": 2
    }
}

Increment a property by 1 (shorthand version):

{ "increment": "myNumberProperty" }

Increment a variable by 2:

{
    "increment": {
        "variable": "myNumberVariable",
        "by": 2
    }
}

"random" Action #

An action to generate random numbers in a given range. The range is inclusive. If no range is specified 0 to Number.MAX_SAFE_INTEGER (2^53 - 1) is used as range.

Parameters:

Parameter Required Default Description
"range" - [0, 9007199254740991] A number array with a minimum and maximum value. The range is inclusive the minimum and maximum values.
"float" - false Whether the action should generate float numbers or not.
"as" - random Specifies the name of the output variable.

Properties:

Properties Description
Shorthand Parameter "range"
Output Variable Type number
Context Mode For-Each
Changes Context No

Examples:

Generate a random integer between 0 and 10::

{
    "random": {
        "range": [0, 10],
        "as": "myOutputVariableName"
    }
}

Shorthand version:

{ "random": [0, 10] }

Generate a random float number between 0 and 10:

{
    "random": {
        "range": [0, 10],
        "float": true,
        "as": "myOutputVariableName"
    }
}

Array Actions #

"append" Action #

An action that appends an item to an array.

Parameters:

Parameter Required Default Description
"to" > "property" Yes or "variable" - The array property to append the item to.
"to" > "variable" Yes or "property" - The array variable to append the item to.
"item" Yes - The item to append to the array. Either a value, variable.

Properties:

Properties Description
Shorthand Parameter None
Output Variable Type None
Context Mode For-Each
Changes Context No

Examples:

Append a string item to an array inside a property:

{
    "append": {
        "to": { "property": "myStringArrayProperty" },
        "item": "Hello World"
    }
}

Append a string variable to an array inside a property on a non-selected concept:

{
    "append": {
        "to": { "property": "myConcept.myStringArrayProperty" },
        "item": "$myStringVariable"
    }
}

Append a string to an array inside a variable:

{
    "append": {
        "to": { "variable": "myStringArrayVariable" },
        "item": "Hello Varv"
    }
}

"index" Action #

An action that gets the index of an item in an array.

Parameters:

Parameter Required Default Description
"of" > "property" Yes or "variable" - The array property in which the index of the item should be found.
"of" > "variable" Yes or "property" - The array variable in which the index of the item should be found.
"item" Yes - The item from which the index should be found.
"as" - index Specifies the name of the output variable.

Properties:

Properties Description
Shorthand Parameter "property" or "variable"
Output Variable Type number
Context Mode For-Each
Changes Context No

Examples:

A full example of finding the index of an item in an array property:

{
    "index": {
        "of": { "property": "myArrayProperty" },
        "item": "myLookupItem",
        "as": "myResultVariableName"
    }
}

Shorthand example that looks up the item myLookupItem inside the property myArrayProperty, and saves the index in the variable index:

{ "index": { "myArrayProperty": "myLookupItem" }}

Shorthand example with a variable myArrayVariable:

{ "index": { "$myArrayVariable": "myLookupItem" }}

"insert" Action #

An action that inserts an item into an array at a given index position.

Parameters:

Parameter Required Default Description
"to" > "property" Yes or "variable" - The array property to insert the item into.
"to" > "variable" Yes or "property" - The array variable to insert the item into.
"index" Yes - The index position of an array. Using 0 for the index prepends the item.
"item" Yes - The item to insert into the array. Either a value, variable.

Properties:

Properties Description
Shorthand Parameter None
Output Variable Type None
Context Mode For-Each
Changes Context No

Examples:

Insert a string item into an array inside a property:

{
    "insert": {
        "to": { "property": "myStringArrayProperty" },
        "index": 7,
        "item": "Hello World"
    }
}

Insert a string variable into an array inside a property on a non-selected concept:

{
    "insert": {
        "to": { "property": "myConcept.myStringArrayProperty" },
        "index": 3,
        "item": "$myStringVariable"
    }
}

Insert a string into an array inside a variable:

{
    "insert": {
        "to": { "variable": "myStringArrayVariable" },
        "index": 2,
        "item": "Hello Varv"
    }
}

"items" Action #

An action that stores the items of an array property or variable in a variable. It allows also for filtering items.

Parameters:

Parameter Required Default Description
"property" Yes or "variable" - The array property to get the items from.
"variable" Yes or "property" - The array variable to get the items from.
"where" - - Specifies how items should be filtered by given conditions (similar to the "where" action).
"as" - items Specifies the name of the output variable.

Properties:

Properties Description
Shorthand Parameter "property" or "variable"
Output Variable Type array
Context Mode For-Each
Changes Context No

Examples:

Simple example on a property:

{
    "items": {
        "property": "myArrayProperty",
        "where": { "equals": "my-specific-value" },
        "as": "myOutputVariableName"
    }
}

Property example, on non selected concept:

{
    "items": {
        "property": "myConcept.myArrayProperty",
        "as": "myOutputVariableName"
    }
}

Simple example (shorthand version):

{ "items": "myArrayProperty" }

Variable example:

{
    "items": {
        "variable": "myArrayVariable",
        "where": { "equals": "my-specific-value" },
        "as": "myOutputVariableName"
    }
}

Variable example (shorthand version):

{ "items": "$myArrayVariable" }

"join" Action #

An action that can join the items of an array into a string using a given separator.

Parameters:

Parameter Required Default Description
"property" Yes or "variable" - The array property to join.
"variable" Yes or "property" - The array variable to join.
"separator" - , Specifies the separator to be placed in between items in the string.
"as" - join Specifies the name of the output variable.

Properties:

Properties Description
Shorthand Parameter "property" or "variable"
Output Variable Type string
Context Mode For-Each
Changes Context No

Examples:

A simple example:

{
    "join": {
        "property": "myArrayProperty",
        "separator": ";",
        "as": "myOutputVariableName"
    }
}

A simple example (shorthand version):

{ "join": "myArrayProperty" }

An example using a variable:

{
    "join": {
        "variable": "myArrayVariable",
        "separator": " ",
        "as": "myOutputVariableName"
    }
}

An example using a variable (shorthand version):

{ "join": "$myArrayVariable" }

"prepend" Action #

An action that prepends an item to an array.

Parameters:

Parameter Required Default Description
"to" > "property" Yes or "variable" - The array property to prepend the item to.
"to" > "variable" Yes or "property" - The array variable to prepend the item to.
"item" Yes - The item to prepend to the array. Either a value, variable.

Properties:

Properties Description
Shorthand Parameter None
Output Variable Type None
Context Mode For-Each
Changes Context No

Examples:

Prepend a string item to an array inside a property:

{
    "prepend": {
        "to": { "property": "myStringArrayProperty" },
        "item": "Hello World"
    }
}

Prepend a string variable to an array inside a property on a non-selected concept:

{
    "prepend": {
        "to": { "property": "myConcept.myStringArrayProperty" },
        "item": "$myStringVariable"
    }
}

Prepend a string to an array inside a variable:

{
    "prepend": {
        "to": { "variable": "myStringArrayVariable" },
        "item": "Hello Varv"
    }
}

"slice" Action #

An action to create a clone of an array or a part of it. Cloned slices of arrays of type concept are always shallow, i.e., the referenced concept instances remain the same.

Parameters:

Parameter Required Default Description
"of" > "property" Yes or "variable" - The array property to create a sliced clone of.
"of" > "variable" Yes or "property" - The array variable to create a sliced clone of.
"start" - 0 Specifies the name of the output variable.
"end" - Index of the last array item Specifies the name of the output variable.
"as" - slice Specifies the name of the output variable.

Properties:

Properties Description
Shorthand Parameter "of"
Output Variable Type array
Context Mode For-Each
Changes Context No

Examples:

Creates a cloned slice of an array property:

{
    "slice": {
        "of": { "property": "myArrayProperty" },
        "start": 3,
        "end": 10,
        "as": "myOutputVariableName"
    }
}

Creates a complete clone of an array property on a non-selected concept:

{
    "slice": {
        "of": { "property": "myConcept.myArrayProperty" },
        "as": "myOutputVariableName"
    }
}

Creates a complete clone of an array property (shorthand version):

{ "slice": "myArrayProperty" }

Creates a cloned slice of an array variable from a start index until the end of the array:

{
    "slice": {
        "of": { "variable": "myArrayVariable" },
        "start": 3,
        "as": "myOutputVariableName"
    }
}

Creates a complete clone of an array variable (shorthand version):

{ "slice": "$myArrayVariable" }

"removeFirst" Action #

An action that removes the first item from an array and outputs it as a variable.

Parameters:

Parameter Required Default Description
"of" > "property" Yes or "variable" - The array property to remove the item from.
"of" > "variable" Yes or "property" - The array variable to remove the item from.
"as" - removeFirst Specifies the name of the output variable.

Properties:

Properties Description
Shorthand Parameter "of"
Output Variable Type The array type
Context Mode For-Each
Changes Context No

Examples:

Remove the first item from an array property:

{
    "removeFirst": {
        "of": { "property": "myArrayProperty" },
        "as": "myOutputVariableName"
    }
}

Remove the first item from an array property on a non-selected concept:

{
    "removeFirst": {
        "of": { "property": "myConcept.myArrayProperty" },
        "as": "myOutputVariableName"
    }
}

Remove the first item from an array property (shorthand version):

{ "removeFirst": "myArrayProperty" }

Remove the first item from an array variable:

{
    "removeFirst": {
        "of": { "variable": "myArrayVariable" },
        "as": "myOutputVariableName"
    }
}

Remove the first item from an array variable (shorthand version):

{ "removeFirst": "$myArrayVariable" }

"removeItem" Action #

An action that removes an item at a given index from an array and outputs it as a variable.

Parameters:

Parameter Required Default Description
"of" > "property" Yes or "variable" - The array property to remove the item from.
"of" > "variable" Yes or "property" - The array variable to remove the item from.
"index" Yes - The index of the item to remove.
"removeCount" - 1 The index of the item to remove.
"as" - removeItem Specifies the name of the output variable.

Properties:

Properties Description
Shorthand Parameter None
Output Variable Type The array type or an array of the array type (when multiple items are removed)
Context Mode For-Each
Changes Context No

Examples:

Remove two items at the given index from an array property:

{
    "removeItem": {
        "of": { "property": "myArrayProperty" },
        "index": 7,
        "removeCount": 2,
        "as": "myOutputVariableName"
    }
}

Remove the item at the given index from an array property on a non-selected concept:

{
    "removeItem": {
        "of": { "property": "myConcept.myArrayProperty" },
        "index": 3,
        "as": "myOutputVariableName"
    }
}

Remove the item at the given index from an array variable:

{
    "removeItem": {
        "of": { "variable": "myArrayVariable" },
        "index": 4,
        "as": "myOutputVariableName"
    }
}

"removeLast" Action #

An action that removes the last item from an array and outputs it as a variable.

Parameters:

Parameter Required Default Description
"of" > "property" Yes or "variable" - The array property to remove the item from.
"of" > "variable" Yes or "property" - The array variable to remove the item from.
"as" - removeLast Specifies the name of the output variable.

Properties:

Properties Description
Shorthand Parameter "of"
Output Variable Type The array type
Context Mode For-Each
Changes Context No

Examples:

Remove the last item from an array property:

{
    "removeLast": {
        "of": { "property": "myArrayProperty" },
        "as": "myOutputVariableName"
    }
}

Remove the last item from an array property on a non-selected concept:

{
    "removeLast": {
        "of": { "property": "myConcept.myArrayProperty" },
        "as": "myOutputVariableName"
    }
}

Remove the last item from an array property (shorthand version):

{ "removeLast": "myArrayProperty" }

Remove the last item from an array variable:

{
    "removeLast": {
        "of": { "variable": "myArrayVariable" },
        "as": "myOutputVariableName"
    }
}

Remove the last item from an array variable (shorthand version):

{ "removeLast": "$myArrayVariable" }

Flow Actions #

"exit" Action #

An action that stops the action chain and does not forward an event.

Parameters:

This action has no parameters.

Properties:

Properties Description
Shorthand Parameter None
Output Variable Type None
Context Mode Bulk
Changes Context No

Examples:

Simple example:

{ "exit" }

"run" Action #

An action that runs another action and, after running it, continues with the action chain passing on the event from before the "run" action independently of the outcome of the ran action (e.g., if the other actions contains an "exit" or modifies the event).

Parameters:

Parameter Required Default Description
"action" Yes - The name of the action that should be run.

Properties:

Properties Description
Shorthand Parameter "action"
Output Variable Type None
Context Mode For-Each
Changes Context No

Examples:

Simple example:

{ "run": { "action": "myActionName" }}

Shorthand version:

{ "run": "myActionName" }

"switch" Action #

An action that can execute several branches of actions chains. Each branch can contain a condition using the same filtering to the "where" action.

Parameters:

Parameter Required Default Description
[] Yes - The action takes a shorthand array of branches.

Branch Parameters:

Parameter Required Default Description
where - - A filter to test a condition for a branch. If not set a branch will always be executed.
then Yes - An action chain that should be computed for a branch.
break - true By default, once a branch is taken the remaining ones are skipped. If set to false also further branches are checked.

Properties:

Properties Description
Shorthand Parameter This action only has a shorthand version.
Output Variable Type None
Context Mode For-Each
Changes Context No

Examples:

A simple example using three branches. Two with conditions and one as a default option:

{
    "switch": [
        {
            "where": { "property": "myProperty", "equals": "myValue" },
            "then": [ "myAction", "myOtherAction" ],
            "break": false
        },
        {
            "where": { "property": "myProperty", "equals": "myOtherValue" },
            "then": [ "myAction", "myOtherAction" ]
        },
        { "then": [ "myDefaultAction" ] }
    ]
}

Timing Actions #

"wait" Action #

An action that waits for a given duration of time before continuing in the action chain.

Parameters:

Parameter Required Default Description
"duration" Yes - The duration to wait in milliseconds.

Properties:

Properties Description
Shorthand Parameter "duration"
Output Variable Type None
Context Mode Bulk
Changes Context No

Examples:

Simple example of waiting for 100 milliseconds:

{ "wait": { "duration": 100 }}

Shorthand version:

{ "wait": 100 }

Debug Actions #

"debugConcept" Action #

An action that prints the ID of the current target of a context.

Parameters:

This action has no parameters.

Properties:

Properties Description
Shorthand Parameter None
Output Variable Type None
Context Mode For-Each
Changes Context No

Examples:

Simple example:

{ "debugConcept" }

"debugContext" Action #

An action that prints the current event including all contexts to the console.

Parameters:

This action has no parameters.

Properties:

Properties Description
Shorthand Parameter None
Output Variable Type None
Context Mode Bulk
Changes Context No

Examples:

Simple example:

{ "debugContext" }

"debugMessage" Action #

An action that prints a message to the console. The message can include variables.

Parameters:

Parameter Required Default Description
"message" Yes - The message that should be printed to the console. Can include variables.

Properties:

Properties Description
Shorthand Parameter "message"
Output Variable Type None
Context Mode For-Each
Changes Context No

Examples:

Simple example:

{ "debugMessage": { "message": "The message to debug" }}

Shorthand version:

{ "debugMessage": "The message to debug" }

Example with a variable:

{ "debugMessage": "My value is $myVariable$" }

© 2023 Aarhus University | Made by cavi.au.dk | Contact Person: Clemens Nylandsted Klokmose