Generic

◷ Reading Time: 4 minutes

A function is an expression that performs a task. Function defines a relation between a set of inputs and its outputs.

Expression allows new objects to be created from a registered type. Please note that to register a type at the modeling level, Using can be used.

array

Builds a sequence of values that implements the IList<object> interface. You can then use the interface properties and methods (e.g., Add, Remove, etc.) to manipulate the list.

 array (exp1, exp2, exp3...)
  • exp1, exp, 2: The list of expressions or values (Optional). If you don’t add any values, it will create an empty array.
Example: array ( 3.4, 145 )
Result: [3.4, 145]
Example: array () 
Result: [] 

(An empty array)
Example: array ( today(), 145 ) 
Result: [3/12/2020 12:00:00 AM, 145] 

guid

Creates an instance of the GUID structure. GUID Represents a globally unique identifier (GUID). A GUID is a 128-bit integer (16 bytes) that can be used across all computers and networks wherever a unique identifier is required. Such an identifier has a very low probability of being duplicated.

 guid (value)
  • value: when provided, it creates GUID based on the value. Otherwise, it generates new GUID. Pass null value to generate new GUID (Optional)
Example: guid (null)
Result: new GUID value i.e. 4e460ce4-05a8-4875-99d3-e7dd09454f55
Example: guid ()
Result: new GUID value i.e. 4e460ce4-05a8-4875-99d3-e7dd09454f55
Example: guid ('18985823-7dbd-423f-8891-16f2cb286d39')
Result: 18985823-7dbd-423f-8891-16f2cb286d39 

(The string 18985823-7dbd-423f-8891-16f2cb286d39 is converted to a Guid)

resourceRead

Reads a resource by a key-value

 resourceRead (key, language)
  • key (String): resource key
  • language (String): language name (Optional)
Example: 
resourceRead ('GroupName')
Result: Group A

It returns the value of the resource defined in resources.
Example: 
resourceRead ('NombreDelGrupo', 'es')
Result: Grupo A

If you have defined a resource in a specific language, you can return its value.

zip

Creates a set of new objects based on lists of properties values

 zip (objectTemplate)
  • objectTemplate: is an object with key-value lists of properties
Example:
names = ['Joe','Dan']
ages = [24,56]
peopleList = zip ({Name:names, Age:ages})

peopleList = 
[
     {
         "Name" : "Joe",
         "Age" : 24
     },
     {
         "Name" : "Dan",
         "Age" : 56
     }
 ]

Example:
names = ['Joe','Dan'] 
ages = [24,56]
peopleList = zip (range(0,names|count())|select(x,{@'names[x]':ages[x]}))

peopleList = 
{
     "Joe" : 24,
     "Dan" : 56
 }

between

Determines whether a value is within a range.

value |between (lower, upper)
  • lower(Required): Lower bound of a range. Can be a partial expression or value. When it is a value it will consider inclusive.
  • upper(Required): Higher bound of a range. Can be a partial expression or value. When it is a value it will consider inclusive.
  • value(Required): A value to evaluate range condition

Partial expressions are op value format. i.e. <34

Example: 3|between (1, 5) 
Result: True 
Example: 1|between (1, 5) 
Result: True 

(1 is inclusive)
Example: 5|between (1, 5) 
Result: True 

(5 is inclusive) 
Example: 10|between (1, 5) 
Result: False
Example: 5|between (1, <5) 
Result: False

(Upper range is <5. So 5 is not inclusive)  
Updated on August 11, 2021

Was this article helpful?

Related Articles