if - script and chart function
The if function returns a value depending on whether the condition provided with the function evaluates as True or False.

Syntax:
if(condition , then [, else])
Argument | Description |
---|---|
condition | Expression that is interpreted logically. |
then | Expression that can be of any type. If the condition is True, then the if function returns the value of the then expression. |
else |
Expression that can be of any type. If the condition is False, then the if function returns the value of the else expression. This parameter is optional. If the condition is False, NULL is returned if you have not specified else. |
Some of the examples in this topic use inline loads. For more information, see Using inline loads to load data.
Example | Result |
---|---|
if( Amount>= 0, 'OK', 'Alarm' ) |
This expression tests if the amount is a positive number (0 or larger) and returns OK if it is. If the amount is less than 0, Alarm is returned. |