Basic Functions

Basic functions are essential for data processing and serve as the foundational components for developing business logic. To utilize the basic functions:

  1. Find the Functionality panel on the left-hand side of the screen

  2. Expand Utilities and then Basic Functions

  3. Drag the function you want to use into a section on the logic board

Returning the same value

The echo function returns the given input without modification. It can be utilized for intermediate processing within a workflow or for debugging purposes. Additionally, echo serves as a method to generate static input values within the backend.

Merging objects

mergeObjects can combine two or more objects into one.

You can do so by following these steps:

  1. To add more objects, click the + symbol next to the initial input box. This action will create a new input box for each additional object you want to add.

  2. Drag the object boxes onto the inputs in the order you want to add them together.

  3. Trigger the function and expand the output to see if it matches your desired format.

Appending to an array

The arrayPush function appends arrays or individual items to an existing array. To add items or arrays, include them as arguments. Manual static inputs are also supported.

To create a new array:

  1. Drag the array you want to extend onto the first input.

  2. Then drag the items individually into the further inputs, following the order you in which you want to add them.

  3. If necessary, simply add new input boxes by clicking the + icon after any existing input box.

  4. Trigger the function.

Mapping a range

The mapRange function transforms a numeric value from an original range to a target range, both of which are defined by the user. This utility allows for scaling of numbers to fit into different numerical contexts or representations.

To achieve this, follow these steps:

  1. To enter a value for mapping, type it directly into the first input field or drag and drop an output value onto it.

  2. Define the ranges in the second input by writing the names of the corresponding variables with a colon, then a space and then the value.

  3. Hit enter for a line break and add the next value.

You may copy the below code and insert it into the input box, then define the ranges by replacing null with your values.

origMin: null
origMax: null
newMin: null
newMax: null

Adding a delay

The delay function allows you to postpone the propagation of a value in your application, providing greater control over when specific actions occur.

To configure a delay:

  1. The first input field specifies the ID for the delay timer. This ID is used for incorporating multiple delays and required starting from the first delay. Each delay needs its own unique ID.

  2. Add a second input field to insert or link your value.

  3. Introduce a third input field and specify your desired delay in milliseconds (e.g., timeout: 5000 for a five second delay). If this field is omitted, a default of 1000 milliseconds (one second) is applied.

  4. Drag your value onto the Trigger to ensure this delay is activated whenever the input value is modified.

    • If you wish to trigger this delay with every input update, even when the value remains the same, click change in the Trigger section and select the appropriate operational mode.

Checking for true parameters

Checking for all true parameters

To execute a logical AND operation across multiple variables, you can utilize the areAllParamsTrue function. It accurately returns true only when every provided input evaluates to true.

The truth value of the result is determined as follows:

  • Leaving a box blank, inserting NULL, 0 or false or having fewer boxes than the defined number of parameters will result in the output false.

  • Any other value in the input boxes will result in true

  • Additional boxes above the defined number of parameters will be ignored ONLY if they are empty. Otherwise, the output will be false.

How to use the function:

  1. Define the number of needed parameters in the first input box

  2. Add the amount of necessary input boxes

  3. Manually insert or link data

  4. Trigger the function or create a conditional trigger by linking

Checking for one or more true parameters

The isOneOrMoreParamTrue function operates using a logical OR operation, in contrast to using a logical AND operation. This function returns true if at least one of its given parameters is true.

Filling an input box with content other than leaving it empty, entering NULL, 0, or false is interpreted as true.

In contrast to areAllParamsTrue, you don't need to define the number of input boxes. Just follow these steps:

  1. Create however many inputs you need

  2. Manually insert or link values

  3. Trigger the function or create a conditional trigger by linking

Converting JSON data to a string

jsonStringify automatically converts an input to a suitable JSON string. The input should be an object or an array. Subsequent input boxes after the first one are ignored.

Parsing JSON data

The jsonParse function can interpret JSON data from outputs, transforming them into objects that can be utilized in other functions.

NOTE: When manually specifying JSON in a function's input, it is automatically converted into an object. Therefore, explicitly converting it with this function is unnecessary.

NOTE: When manually specifying JSON in a function's input, it is automatically converted into an object. Therefore, explicitly converting it with this function is unnecessary.

Merging arrays

mergeArrays is a function designed to combine multiple arrays by nesting their elements one level deeper into a new array structure. It requires at least one array as input. The function compares the lengths of the input arrays and creates a new array with the length matching the shortest input array. Elements from the original arrays are repositioned as sub-elements at their respective indices within this new array. Any elements beyond the length of the shortest input array are omitted in the output.

To merge arrays:

  1. Add inputs as needed

  2. Drag array within outputs onto the inputs or specify them manually

  3. Trigger the function or create a conditional trigger to run this every time an input array changes

Renaming object keys

The renameObjectKeys function is designed to modify the keys in an object based on a provided mapping. It requires two parameters:

  1. Source Object: The object whose keys need updating, containing original key-value pairs.

  2. Mapping Object: An object defining the new key names, with each property pairing a new key name with its corresponding old key name newKey: oldKey.

Remember to write each mapping in a new line by hitting enter.

For source objects with variable key names, you can drag a dynamic key mapping object into the second input to adapt accordingly.

Last updated