12.03 Using operators in a node
As an example of configuring a node using operators, let's create a scenario in which the input parameters are certain values, and the outcome of the scenario will be the transformation of these values using operators.
To make the scenario work successfully, you need to add 3 nodes:
- (1) A Trigger on Webhook node with a URL to which a POST request is sent, containing the value ValueWH;
- (2) A SetVariables node that adds the value ValueSV to the scenario;
- (3) A Webhook Response node that returns the transformed value using operators;
- (4) Configure the conditions for responding to the execution of the scenario in the Body field of the Webhook Response node.
In scenarios that require processing numerical expressions, operators such as comparison operators (less than, less than or equal to, not equal to, AND, OR, etc.), mathematical operators (addition, subtraction, etc.), and some functions (if, (), not, etc.) are commonly used.
- Input data: ValueWH = 15; ValueSV = 40;
- Expression with operators:
- Answer: 25.
If it is necessary to process string expressions, most often comparison operators (AND, OR, etc.) and functions (if, (), starts with, ends with, string length, etc.) are used.
- Input data: ValueWH = May; ValueSV = October;
- Expression with operators:
If the length of the string ValueWH is less than 4 OR the string ValueSV ends with "er", then the answer is the string ValueSV in uppercase; otherwise, it's ValueWH.
- Answer: OCTOBER
- Input data: ValueWH = May05; ValueSV = October;
- Expression with operators:
- Answer: May05.
The result of executing an expression can depend on the type of fields over which operations are performed. For example, the '+' operator performs concatenation of text fields and addition of numeric fields
Some operators work only with text values or only with numeric values. For instance, the 'length' operator counts the number of characters in a text string.