The Expression Builder
The Expression Builder is used to configure what expression the API checks. You can configure your expression based on the different columns of your database table or compare different variables. The left side of the configuration is the column/variable/value you would like to use. The middle part is the operator where you can select: equals, does not equal, greater than, greater than or equal, less than, less than or equal. The right side is the value that you want to compare the left side to. Here is an example of an expression:
In this example, we are checking to see if a user's email is equal to a specific value in a custom query. If you are using the expression builder in certain functions, you also have access to a special variable called $this to focus on the specific element and any data inside it. We can make more complex expressions using additional conditionals. Clicking on the blue plus button adds more options like "And", Or", "And()", "Or()". "And": adds to the expression where it must match all of the conditions. "Or": adds to the expression where it must match either of the conditions. "And()": adds to the expression where it must match all of the conditions as well as allowing the user to add an additional set of conditions that are wrapped within the parenthesis. An example, of this would be: and( $this < 100 and $this > 30), so this would find any element that is between 30 and 100. "Or()": adds to the expression where it must match either of the conditions as well as allowing the user to add an additional set of conditions that are wrapped within the parenthesis. Additional filtering can be added to the left or right side depending on the Data Type.
- Equals (==) - an exact match
- Not Equals (!=) - does not equal
- Equals with type matching (===) - an exact value match and an exact type match
- Ex. Variable var_1 has a value of 123, with a type of text. You set up a conditional statement to check if var_1 === 123, but your value in the conditional statement is of type integer. This would return false, because the types do not match.
- Not equals with type matching (!==) - does not equal value or type, similar to ===
- Greater than (>) - the value on the left is greater than the value on the right
- Greater than or equals (≥) - the value on the left is greater than or equals to the value on the right.
- Less than (<) - the value on the left is less than the value on the right.
- Less than or equals (≤) - the value on the left is less than or equals to the value on the right.
- LIKE - Used for comparing text. Like is case-insensitive and compares if a text string is like another text string. It can be thought of as equals for text but upper case and lower case does not matter.
- NOT LIKE - Used for comparing text. Not Like is case-insensitive and compares if a text string is not like another. It is like not equals for text but upper case and lower case does not matter.
- INCLUDES - Used for comparing text. Includes is a flexible operator and is case-insensitive. It is able to determine if there is a partial match in a text string.
- DOES NOT INCLUDE - Used for comparing text. Does not include determines if a text string is not included in another text string.
- IN - If a single value is found in an array (list). Start with the single value on the left side and the right side should contain the array.
- NOT IN - If a single value is not found in an array (list). The single value should be on the left side and the array on the right side.
- OVERLAPS - Used for comparing two arrays. Overlaps determines if any values in one array are present in the second array.
- DOES NOT OVERLAP - Used for comparing two arrays. Does not overlaps determines if no values in the first array are present in the second array.
- CONTAINS* - Contains is an advanced filter used for JSON and arrays. It looks for an exact schema match.
- DOES NOT CONTAIN* - Does not contain is the opposite of contains. It determines if there is not an exact schema match.
Query Operators become filters in Expression Builders outside of the Query All Records function (Conditionals, Array functions, etc.). The filter can be applied and the expression set to equal (or not equals) a true or false boolean.
*The contains filters are different than the contains operators.