Expressions are logic statements which are used to obtain the values of fields. These expressions are made up of a combination of functions, fields references and operators. In this post we will go through the not equals operators and its use cases, how to implement it and some examples of it.
There are two different types of expressions we can implement the not equals operators being the string and numeric expressions. For numeric expressions, the operators to use are ‘<>’ where you put the numbers or fields you wish to compare either side of it. The string expressions work similarly but uses ‘ne’ as an abbreviation of not equals with the strings or fields either side of the operator.
A simple use case of where this could be used for numeric expression is to determine if two number fields are identical. In this example, two number fields are created name ‘A’ and ‘B’ and a text field will use an expression to find if the two number fields are the same.
Now for the expression for the text field an if statement would need to be used which you can learn more here.
Once the expressions are added and the app is resynced the not equals expression should be working as expected.
String expressions are mostly used in filters such as with form rules to determine is a template meets a certain criterion. An example of a use case of this it to simplify a template in which if a problem is raised a description box would be shown. To start let’s create the fields where there will be a text field for the title of the record and another text field for the user to fill in what the problem is. Then there will be a long text field to provide a description.
After the fields are created let’s create two templates with one containing the description field and one without the description field and add it to the form.
Now comes the form rules which you can find at the bottom of form creation page. Which as you can see in the image below the not equal operator is used to hide the template without description with the filter rule $filter=[Problem] ne ''. This works as it determines if the problem fields is not equals to being empty and if it is it will hide the following template.
So now if the problem field is not filled in it will hide the template with description.
But if it is filled in it will now hide that template and instead show the template with description.
Please sign in to leave a comment.