• Beta
Formula Editor
  • 09 Aug 2024
  • 3 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

Formula Editor

  • Dark
    Light
  • PDF

Article summary

The formula editor is used in multiple places in IMS, for example in the Dynamic Forms Validation Rules, as well in the IOW Virtual Tags expressions.

All the functions have their own button in the formula editor. Hover over them to get a tooltip with the explanation of what that function does and how to use it. You can also use the Test Values to test the formula.

Formula editor.

Also remember to add 1:0 or 0:1 at the end of your IF statement. For example: 

"IF ($x<y?1:0)" means True if x<y and False otherwise.

"IF ($x<y?0:1)" means False if x<y and True otherwise. 

Example

Example 1: Below an example of a Validation Rule is given:

When the value entered for the "Operating Pressure" Field is more than 150 then a yellow button will show with a Wanning message. When a value less then or equal to 150 is entered then a green button will show. In this example we entered the value "10" for the Operating Pressure and click Test. The result is "False". This is expected as 10 is less than 150.

Formula Editor Operators and Functions

The following tables describe the Operators and Functions used in the Formula Editor, as well as examples of how to use them.

Mathematical Operators

Description

Syntax Example

COS

Calculates the cosine value of an angle (in radians). The value is always in the range of -1 to 1.

COS(3.14159...) = -1

SIN

Calculates the sine value of an angle (in radians). The value is always in the range of -1 to 1.

SIN(1) = 0.8414709...

TAN

Calculates the tangent value of an angle (radians). The value is always in the range of -1 to 1.

TAN(1) = 1.55740...

LOG

The logarithm function takes two arguments (number, base) and calculates the logarithm. 

LOG(100,10) = 2

π

Pi = 3.14159...


y

The power function takes two arguments (x, y) and returns the base value raised to the power value.

POW(5,3) = 5= 125

√ x


Calculates the square root of a number (x).

SQR(100) = 10

/

Division operator.

100 / 2 = 50

*

Multiplication operator.

5 * 2 = 10

-

Subtraction operator.

10 - 2 = 8

+

Addition operator.

10 + 2 = 12

ABS

Calculates the absolute value of a number.

ABS(-3) = 3

Logic Operators

Description

Syntax Example

IF

The IF() function is used to evaluate a statement in the Formula Editor.  It will return TRUE or FALSE, depending on the parameters provided.

IF ($x<y?1:0)" returns TRUE if x<y and FALSE otherwise. 

IF ($x<y?0:1)" returns FALSE if x<y and TRUE otherwise.

AND

AND is used to combine two or more conditions.

IF ($x < $y AND $x < $z ? 1:0) returns TRUE if both conditions are satisfied, FALSE otherwise. 

OR

AND is used to combine two or more conditions.

IF ($x < $y OR $x < $z ? 1:0) returns TRUE if at least one of the two conditions is satisfied, FALSE otherwise.

The below functionality is not available (or needed) for Virtual Tags, only for the Validation Rules:

Other Operators

Description

Syntax Example

IsNull

Checks to see if any parameters provided to the function are empty.

IsNullOrEmpty($field1,$field2,$field3) returns True if any of the fields provided are empty.

!IsNull

Checks to see if any parameters provided to the function are empty.

!IsNullOrEmpty($field1,$field2,$field3) returns True if all of the fields provided are filled in.

CONS

Check to see if a String (first parameter) contains another String (second parameter). If a third parameter is set to TRUE, the check will be case sensitive.

Contains('I went to the store.', 'basket') returns FALSE.

Contains('I went to the store', 'Store',true) returns FALSE.

Contains('I went to the store','Store') returns TRUE.

IsAsc, IsAsc*

Checks to see if the parameters provided are in ascending order. The * version allows for equal adjacent numbers.

IsAscendingOrder(1,2,4,7) returns TRUE.

IsNonStrictAscendingOrder(1,1,2,4,4,6) returns TRUE.

IsAscendingOrder(1,2,7,4) returns FALSE.

IsDesc, IsSesc*

Checks to see if the parameters provided are in descending order. The * version allows for equal adjacent numbers.

IsDescendingOrder(5,2,1) returns TRUE.

IsNonStrictDescendingOrder(5,5,2,1) returns TRUE.

IsDescendingOrder(1,2,7,4) returns FALSE.

EqAdjNo

Checks to see if any adjacent parameters provided are the equal.

AnyEqualAdjacentNumber(1,2,2,4) returns TRUE.

All No

Checks to see if all provided parameters are numeric.  

AllNumericValues(1,4,a,7) returns FALSE.

EqStr, !EqStr

Checks to see if all provided parameters (strings) are equal.

EqualStr($field1,$field2) returns TRUE if $field1 and $field2 contain the same string.

NotEqualStr($field1,$field2) returns TRUE if $field1 and $field2 do not contain the same string. 


Was this helpful? Click to add feedback comments

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.
ESC

Eddy AI, facilitating knowledge discovery through conversational intelligence