General Functions

Rita Pang
Rita Pang
  • Updated

Refer to the below for a list of general functions available within Alaya Connector.

Variables

executionId

This function returns the ID of the current execution and is recommended for logging and monitoring.

Functions

get (object or array; path)

This function returns the value path of an object or array. To access nested objects, use the dot notation. The first item in an array is index 1.

get(array;1+1)
get(array;5.raw_name)
get(object;raw_name)
get(object;raw_name.sub_raw_name)

if (expression; value1; value2)

This function returns value 1 if the expression is evaluated to be true. Otherwise, it returns value 2.

if(1=1;A;B)
= A
if(1=2;A;B)
= B

ifempty (value1; value2)

This function returns value 1 if this value is not empty. Otherwise, it returns value 2.

ifempty(A;B)
= A
ifempty(unknown;B)
= B
ifempty("";B)
= B

switch (expression; value1; result1; [value2; result2; ...]; [else])

This function evaluates one value (called the expression) against a list of values, and returns the result corresponding to the first matching value.

switch(B;A;1;B;2;C;3)
= 2
switch(C;A;1;B;2;C;3)
= 3
switch(X;A;1;B;2;C;3;4)
= 4

omit (collection; key1; [key2; ...])

This function removes elements with the given keys from a collection, and returns a collection with the remaining elements. It is recommended for users who want to pass a collection to an API, which expects an exact number of elements in the collection. Users can make sure their collection meets the requirements of the API with this function.

pick (collection; key1; [key2; ...])

This function picks elements with the given keys from a collection, and returns a collection that contains only the picked elements. It is recommended for users who want to pass a collection to an API, which expects an exact number of elements in the collection. Users can make sure their collection meets the requirements of the API with this function.

Was this article helpful?

0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.