Generic

◷ Reading Time: 3 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...)
Example: array ( 3.4, 145 )
 Result: a list that has all of the provided values.

Example:  array () 
 Result: an empty list.

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 (optional): when provided, it creates GUID based on the value. Otherwise, it generates new GUID. Pass null value to generate new GUID.

Example:

guid (null)
Returns: new GUID value i.e. 4e460ce4-05a8-4875-99d3-e7dd09454f55

resourceRead

Reads a resource by a key value

 resourceRead (key, language)
  • key: resource key
  • lang: language name

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 1:

names = ['Joe','Dan']
ages = [24,56]
peopleList = zip ({Name:names, Age:ages})

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

Example 2:

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 partial expression or value. When it is a value it will considered inclusive.
  • upper(Required): Higher bound of a range. Can be partial expression or value. When it is a value it will considered inclusive.
  • value(Required): A value to evaluate range condition

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

Example: 2|between (2, <56) 
Result: true. 2 is inclusive.
Updated on July 6, 2020

Was this article helpful?

Related Articles