Conditional functions
Learn about conditional functions in the Digibee Integration Platform and how to use them.
Last updated
Was this helpful?
Learn about conditional functions in the Digibee Integration Platform and how to use them.
Last updated
Was this helpful?
The conditional functions return a value according to the criteria you establish and are available for components that support Double Braces expressions. To know how to provide information to the components using this resource, refer to .
By using Double Braces, you can combine the function with the access to the input JSON element of a component.
The function compares two objects (that can be numbers, strings, arrays, etc.) and verifies if they're the same.
Let's say you need to validate if this object
is the same as this one:
In the example below the false
value will be returned, because the objects are different:
By using Double Braces, you can combine the function with the access to the input JSON element of a component.
The function compares if the first number is greater than the second.
In the example below the "false" value will be returned:
The null
value is considered as the smallest possible value for comparison.
GREATERTHAN(null, null)
will return false
.
By using Double Braces, you can combine the function with the access to the input JSON element of a component.
The function compares if the first number is greater than or equal to the second.
In the example below the false
value will be returned:
The null value is considered as the smallest possible value for comparison.
GREATERTHANEQUAL(null, null)
will return true
.
By using Double Braces, you can combine the function with the access to the input JSON element of a component.
The function allows you to make logical comparisons between a value and what you wait for.
Therefore, an IF instruction can have 2 results. The first result happens when the comparison is true and the second when it's false.
Let's say you need to make decisions depending if the received value is true
or false
:
In the example below the condition value (value-if-false) will be assigned to JSON:
By using Double Braces, you can combine the function with the access to the input JSON element of a component.
The function compares if the first number is smaller than the second.
In the example below the true
value will be returned:
The null
value is considered as the smallest possible value for comparison.
LESSTHAN(null, null)
will return false
.
By using Double Braces, you can combine the function with the access to the input JSON element of a component.
The function compares if the first number is smaller than or equal to the second.
In the example below the "true" value will be returned:
The null
value is considered as the smallest possible value for comparison.
LESSTHANEQUAL(null, null)
will return true
.
By using Double Braces, you can combine the function with the access to the input JSON element of a component.
The function allows you to verify if the provided argument is an object.
Let's say you need to verify if the received argument is an object:
Validating the argument:
The response will be false
, because the value isn't an object.
Now passing an object to the function:
Validating the argument:
The response will be true
.
By using Double Braces, you can combine the function with the access to the input JSON element of a component.
The function allows you to verify if the provided argument is an array.
Let's say you need to verify if the received argument is an array:
Validating the argument:
The response will be false
, because the value isn't an array.
Now passing an object to the function:
Validating the argument:
The response will be true
.
By using Double Braces, you can combine the function with the access to the input JSON element of a component.
The function allows you to verify if the provided argument is a boolean value.
Let's say you need to verify if the received argument is a boolean value:
Validating the argument:
The response will be "true", because the value is boolean.
Now passing an object to the function:
Validating the argument:
The response will be “false”.
By using Double Braces, you can combine the function with the access to the input JSON element of a component.
The function allows you to verify if the provided argument is a string.
Let's say you need to verify if the received argument is a string:
Validating the argument:
The response will be true
, because the value is a string.
By using Double Braces, you can combine the function with the access to the input JSON element of a component.
The function allows you to verify if the provided argument is a number.
Let's say you need to verify if the received argument is a number:
Validating the argument:
The response will be "true", because the value is a number.
By using Double Braces, you can combine the function with the access to the input JSON element of a component.
The function allows you to verify if the provided argument is null
.
Let's say you need to verify if the received argument is a null value:
Validating the argument:
The response will be true
, because the value is a null value.
By using Double Braces, you can combine the function with the access to the input JSON element of a component.
The function allows you to provide multiple comparisons and the due parameters that must be returned if one of these validations returns true
. If no validation returns true
, the defined pattern will be used.
Let's say you need to validate some conditions to make a decision:
Validating the argument:
Therefore, the function configuration will be:
Valor default: "failed"
Condition 1: ISNULL(message.argument)
Result If Condition 1 Matches: "ok"
Condition 2: ISNUMBER(message.argument)
Result If Condition 2 Matches: "nok"
The response will be "ok", because the first condition was met.