Case IQ Knowledge Base

How can we help?

Case IQ Expression Language

You can program the Case IQ application to automatically fill in certain form fields by evaluating an “expression”, which is a computer-interpretable representation used to access the system’s data by using arithmetic, relational, and logical operators. The application will evaluate the expression to determine the value to populate in the field. A field that is set by an expression instead of direct user input is called a “computed field”. You can create computed fields using the Form Builder (see Use the Form Builder) and adding a "Set Field Value" rule (see Add a Rule).

If you choose to create a computed field, an “expression” text box will be displayed, where you can tell the system how to compute the field value using Case IQ Expression Language (ISEL). ISEL is based on a Node.js implementation of JavaScript Expression Language (JEXL). This article covers all basics of ISEL so you can get started writing expressions in Case IQ, including the following:

  • The basic language conventions and syntax of the version of JEXL on which ISEL is based. 
  • The unique functions available in ISEL. 
  • A glossary of ISEL examples, which you can copy from this document and paste into the application. 

You will not need to install the JEXL library or its dependencies to get started! The Case IQ expression field is a sandbox, or an isolated online virtual machine, where you can get started entering expressions right away.

Data Type of Computed Fields on Forms

When adding a computed field to a form layout (see User the Form Builder), consider how you want the field to be used in the application when choosing its data type, e.g. text box, date, number, etc. Think about how a user would expect to see the computed field's information presented or formatted in application. For example, you can use a checkbox field for expressions that return either a “Yes” or “No” result. However, it would be more difficult to run a search for cases based on a checkbox value, as you would have to run an Advanced Search (see Search in Case IQ).

 

Use Cases

We have put together expressions for the following common situations when you may want the system to automatically fill in a field’s value. If you see an expression that is applicable for your situation, copy the expression text from this article and paste it into the “expression” field in Case IQ. Your application will likely have different names for fields, so make sure to replace the field names in the expression per your application. We have created these example expressions following ISEL conventions outlined in the “Expression Language and Syntax”, “ ISEL Functions”, and “Context Objects” tabs of this article. 

All example expressions are created for the case form, except “Calculate a Party's Age”. If you want to add a computed field to another form, change the object to the form name.


Today's Date

Populate a field with the current date when the case is saved.

Set Field

Name Type Values
Today Date N/A. 

Expression for Today field:

if(isEmpty(this.value)) then now else this.value

Calculate a Party's Age

Calculate a person's age based on their date of birth on the party form. In this example, the “Age" field has been added to the party form, so party is used as the object in the expression.

Input Fields

Name Type Value
Date of Birth Date N/A, system field.

Set Field

Name Type Values
Age Integer N/A.

Expression for Age field:

yearsBetween(now, party.dateOfBirth)

Percent

Find the percentage between two case fields' values.

Input Fields

Name Type Value
Field 1 Integer, money, or number N/A, user input.
Field 2 Integer, money, or number N/A, user input.

Set Field

Name Type Values
Percent Number N/A.

Expression for Percent field:

divide(case.field1, case.field2)*100

Categorization

Categorize a case based on the answers to several radio or checkbox questions posed to the user submitting the case. Subsequently, you can use the computed category as display criteria for workflows, workflow steps, or other form fields.

Input Fields

Name Type Value
Question 1 Checkbox N/A. 
Question 2 Radio or picklist “Answer 1”, “Answer 2”, or “Answer 3”.
Question 3 Radio "Yes" or "No".
Question 4 Number N/A, user input.

Set Field

Name Type Values
Category Radio, picklist, or textbox. “Category A” or “Category B”.

Expression for Category field:

(
	(case.question1 == true ? 5 : 0) + 
	(case.question2 == "Answer 3" ? 2 : (case.question2 == "Answer 2" ? 1 : 0)) + 
	(case.question3 == "Yes" ? 1 : 0 ) + 
	case.question4
) > 6 ? "Category A" : "Category B"

Priority By Cost

Calculate priority for a case based on its total cost. The “Priority” will be set to “High” when the “Total Cost” is greater than or equal to $1000, “Medium” when “Total Cost” is greater than or equal to $500 and less than or equal to $1000, and “Low” when “Total Cost” is less than or equal to $500. This may be combined with rules and actions to set specific flags based on the computed field.

Input Fields

Name Type Value
Total Cost Money N/A, user input.

Set Field

Name Type Values
Priority Radio, picklist, or textbox. “High”, “Medium”, or “Low”.

Expression for Priority field:

case.totalCost >= 1000.00 ? 
	'High' : 
	(case.totalCost >= 500 ? 'Medium' : 
	(case.totalCost <= 499.00 ? 'Low' : '')
	)

Priority By Case Type

Calculate priority based on case properties, such as “case type”. In this example, the “Priority” will be set to “High” when case type is “Case Type 1”, “Medium” when case type is “Case Type 2”, and “Low” when case type is “Case Type 3”. This may be combined with rules and actions to set specific flags based on the computed field.

Input Field

Name Type Values
Case Type Picklist "Case Type 1", "Case Type 2", or "Case Type 3".

Set Field

Name Type Values
Priority Radio, picklist, or text box. “High”, “Medium”, or “Low”.

Expression for Priority field:

case.caseType == 'Case Type 1' ? 
	'High' : 
	(case.caseType == 'Case Type 2' ? 'Medium' : 
	(case.caseType == 'Case Type 3' ? 'Low' : '')
	)

Risk Assessment

Assess risk based on Case Type, Likelihood (1-5), Consequence (1-5) and setting the Risk rating. This expression is based on Case IQ's Risk Assessment Matrix.

Input Fields

Name Type Values
Likelihood Picklist 1, 2, 3, 4, 5.
Consequence Picklist 1, 2, 3, 4, 5.

Set Fields

Name Type Values
Risk Rating Number Computed.
Risk Assessment Radio, picklist, or textbox. “Extreme”, “High”, “Medium”, or “Low”.

Expression for Risk Rating field:

sum(case.likelihood, case.consequence)

Expression for Risk Assessment field: 

sum(case.likelihood, case.consequence) <= 6 ? 
	((case.likelihood + case.consequence) < 5 ? "Low" : "Medium") : 
	((case.consequence + case.likelihood) > 7 ? "Extreme" : "High")

Due Date

Calculating the date a case is due by adding either 15 or 30 business days to the created date based on “case type”.

Input Fields

Name Type Values
Date Recorded System date N/A, system field.
Case Type Picklist "Case Type 1", "Case Type 2", or "Case Type 3".

Set Field

Name Type Values
Due Date Date Computed.

Expression for Due Date field:

case.caseType == 'Case Type 1' ? 
	addBusinessDays(case.dateRecorded, 15) : 
	addBusinessDays(case.dateRecorded, 30)

Summary

Calculating the content of a text area field that includes string concatenation and formatting of various other fields such as Case Type, Date Created, Priority, Categories, etc.

Input Fields

Name Type Values
Case Type Picklist Any.
Priority Picklist Any.
Category Picklist Any.

Set Field

Name Type Values
Summary Text area N/A.

Expression for Summary field:

concat('The Case Type is ' 
	+ case.caseType 
	+ '. The Created Date is ' 
	+ case.dateRecorded 
	+ '. The Case Priority is ' 
	+ case.priority 
	+ '. The Case Category is ' 
	+ case.category 
	+ '.'
)

Totals

Calculate a money field whose value is a sum of other money fields (ie. total amount charged or owed).

Input Fields

Name Type Values
Payment 1 Money N/A, user input.
Payment 2 Money N/A, user input.
Payment 3 Money N/A, user input.

Set Field

Name Type Values
Total Money N/A.

Expression for Total field:

sum(case.payment1, case.payment2, case.payment3)

Write Up

Joining case information into a text area field to include the content in email or file templates and distribution. May include properties such as the Name and Email address of the case submitter or the last acting user and global system context properties such as "System Name" and "Support Address".

This example only uses system fields as the inputs, meaning that you will not need to add fields to a form for the input fields. You only need to add the field you want Case IQ to set.

Input Fields

Name Type Values
Case Number System text N/A, system field.
Date Recorded System date N/A, system field.
Case Status System text N/A, system field.

Set Field

Name Type Values
Write Up Text area Computed.

Expression for Write Up field:

join([case.caseNumber, "was recorded on", case.recordedDate, "and has status of", case.status], " ") + "."

Dynamic Case Number Format with Case Type

Set up a dynamic case number format based on the case's type on intake. See details on configuring the case number format and an explanation of each case number component in the Case Number Format article. In this example, the case number prefix will change depending on the “Case Type” field. This expression will generate case numbers in the following format:

CASETYPE-MM-YY-000

  • “CASETYPE”: the system will populate this element with one of the following prefixes, based on the case type selection:
    • COMP
    • INV
    • QUERY
    • OTHER
  • “-”: the character you enter in the "Separator" field will be used to separate each case number component.
  • “MM": the month the case is created using the format you select in the “Month Format” field.
  • “YY”: the year the case is created using the format you select in the “Year Format” field.
  • "000": the sequential case number count that the system generates based on the number of cases added to the application, counting up from 1. The length of the sequence will be determined by your selection in the “Minimum sequence size” field.

Input Fields

Name Type Values
Case Type Picklist "Complaint", "Investigation", or "Query".

Set Field

Name Type Values
Case Number System text N/A, system field.

Expression to enter in the “Expression” field on the Case Number Configuration page:

case.caseType == "Complaint" 
	? "COMP" 
	: (case.caseType == "Investigation" 
		? "INV" 
		: (case.caseType == "Query" 
			? "QUERY" 
			: "OTHER"
		)
	)) 
	+ this.separator 
	+ format(now, this.monthFormat) 
	+ this.separator 
	+ format(now, this.yearFormat) 
	+ this.separator 
	+ padStart(this.sequence, 3, "0")

Dynamic Case Number Format Using Additional Date Field

Set up a dynamic case number format that includes an additional date field set on intake. See details on configuring the case number format and an explanation of each case number component in the Case Number Format article. In this example, the case number month and year will be set by a date field available on the intake form, called “Claim Date”. This expression will generate case numbers in the following format:

YYYY-MM-000

  • “YYYY”: the year set in the “Claim Date” field on intake using the format you select in the “Year Format” field.
  • “-”: the character you enter in the "Separator" field that will be used to separate each case number component.
  • “MM": the month set in the “Claim Date” field on intake using the format you select in the “Month Format” field.
  • "000": the sequential case number count that the system generates based on the number of cases added to the application, counting up from 1. The length of the sequence will be determined by your selection in the “Minimum sequence size” field.

Input Fields

Name Type Values
Claim Date Date or date and time N/A, user input.

Set Field

Name Type Values
Case Number System text N/A, system field.

Expression to enter in the “Expression” field on the Case Number Configuration page:

format(case.claimDate, this.yearFormat) 
+ this.separator 
+ format(case.claimDate, this.monthFormat) 
+ this.separator 
+ padStart(this.sequence, 3, "0")

Set Value of a Static Field

If you want to set up a field whose value can be set by the system evaluating an expression, while remaining editable by a user, you can use a “Set Field Value” rule action. See the “Set Field Value” section under the “Actions” tab of the Add a Rule article for details on creating “Set Field Value” actions. This expression will set the case type field value based on the record source.

Input Fields

Name Type Values
Record Source System picklist "Web", "External", or "Email".

Set Field

Name Type Values
Case Type Picklist "Case Type 1", "Case Type 2", or "Case Type 3".

Expression for Case Type field:

case.recordSource == "web" ? "Case Type 1" : 
	(case.recordSource == "external" ? "Case Type 2" : 
		(case.recordSource == "email" ? "Case Type 3" : "")
	)

Retain Data Submitted on Portal in Read Only Fields

You can create case fields that will be read-only in the internal application to retain the original data submitted by the reporter via the portal. Set up a duplicate field where internal users can edit the answer entered in the field. In this example, portal users can enter text in the “Portal Incident Details” field, but the field will be uneditable on the case's page in the internal application. Internal users can instead enter information in the “Incident Details” field. However, if a portal user does not enter information in the “Portal Incident Details” field, it will be populated with the “Incident Details” text.

Input Fields

Name Type Values
Incident Details Text area N/A, user input.

Set Field

Name Type Values
Portal Incident Details Text area Computed.

Expression for Portal Incident Details field:

case.portalIncidentDetails ? 
	case.portalIncidentDetails : case.incidentDetails

Retain Case Type Submitted on Intake in Read Only Fields

Similar to the previous example, you can create a field to retain the case type selected when the case was initially submitted. The system will copy the “Case Type” option selected by the reporter to the “Intake Case Type” field. Internal users will be able to update the “Case Type” field as needed but the “Intake Case Type” cannot be edited.

Input Fields

Name Type Values
Case Type Picklist "Case Type 1", "Case Type 2", or "Case Type 3".

Set Field

Name Type Values
Intake Case Type Textbox Computed.

Expression for Intake Case Type field:

if(isEmpty(this.value)) then case.caseType else this.value
 
 

Expression Language and Syntax

JEXL is a context-based expression parser and evaluator that uses similar syntax to JavaScript. As ISEL is a simplified version of JEXL, this document only covers the relevant JEXL conventions to ISEL. 

Define Expression Context?

When writing an expression in Case IQ, you do not need to define the context or engine. Simply enter your expression using the operators and syntax documented in this guide.

 

If you are interested in learning more about JEXL, see the JEXL resources on Apache Commons.

Introduction to Expression Format

Expressions must follow a specific format for the system to understand the actions you want it to execute and to what fields. They can include a combination of the following elements:   

Expression Element Description
Function Tells Case IQ the action you want it to perform, such as adding, subtracting, or counting. Refer to the list of ISEL functions you can use in expressions in ISEL API.
Object

Identifies the container of information to which you want to refer in the expression. Forms are the most common object you will use in ISEL expressions. Write the form name where the field you want to be computed is located, such as the case form. 

Do not include spaces between form names that contain multiple words. For example, if you wanted to refer to a form called “Executive Interview”, you would enter executiveinterview as the object name in your expression.

There are 3 additional objects you can use in expressions: now, system and user. See more details on using these objects, including their properties, in the Context Objects section.

Variable

Indicates the specific object information you want the system to use in the expression. In Case IQ, the variables will generally be the fields of a form. Identify a field by entering its name, such as the caseType field. 

The field name is the system name for the field in the application. The system records field names in camel case, where (1) the first word is lower case, (2) all subsequent words begin with a capital letter, and (3) there are no spaces between words.

Tags for fields commonly used in expressions are listed in Appendix A. For additional fields, review Appendix B for detailed steps to identify the correct field name.

As the system evaluates expressions when a form is saved, the system will not be able to parse expressions that include another computed field as a variable in an expression. For example, you would not be able to calculate the sum of two computed fields in an expression. See the Transform Expressions section in the ISEL Functions tab of this article for information on how to include multiple functions in an expression.

Value or Literal A constant number or string of characters you want the system to use in the expression.
Operator Tells the system (1) what action to perform with or (2) how to compare any variables or values in the expression. See the next section in this guide, Operators, for a list of all operators you can use in expressions.

You can combine the functions and operators listed in this guide with objects and variables from your application to create ISEL expressions. For example, you could set up a field to be automatically filled in with any money amount entered in a field on the case form, say the “Total Expense” field, plus 15% tax. For the field you want the system to fill in with this sum, you would enter the following in the “Expression” text box:

This expression would tell the system to multiply the amount in the “Total Expense” field by 1.15 and fill in the computed field with the amount it calculated.

You do not have to include static values in your expressions and can opt to only use variables as your inputs. For example, you could calculate the total expenses of a case by adding two case fields, called “Cash Expenses” and “Credit Card Expenses”, then fill in a field with the sum of those amounts. You would enter the following in the “Expression” text box for the field you wanted the system to fill in.

As ISEL is based on JEXL, use the same syntax and operators as you would writing JEXL expressions, which are covered in this section of the guide. However, ISEL contains unique functions, which are covered in the next section of this guide, ISEL API. For all ISEL functions, you can either use the format outlined in the String Functions, Math Functions, and Date Functions sections of this guide or transform your expressions, so you have the option to include multiple functions in the same row, as detailed in Transform Expressions.

Help with Object, Function, and Variable Names

As you type your expression, Case IQ will suggest available objects, functions, and variables you can use. 

Don’t know the name of the object, function, or variable you want to use in your expression? Case IQ can pull a list for you! Click the Expression text box, then hit Ctrl and Space on your keyboard and Case IQ will display a list of all functions and objects you can use. After entering an object name followed by a period, you can hit Ctrl and Space to pull a list of all the object’s variables.

 

Operators

Use an operator symbol in expressions to tell the system what action to perform with or how to compare any variables or values in the expression. For example, you can perform arithmetic with operators:

You can also combine a “string”, or an object storing a text, with a variable using the + operator, as in the example below: 

The following table lists all operators you can use to create expressions with ISEL. For most operators, you can use either the symbol or the English word or phrase in expressions.

Type of Operator Operation Symbol English Word/Phrase
Unary Negate (not) ! not
State the condition of a conditional expression (see the Conditional Expressions and Ternary Operators section below). Not applicable if(condition)
Increment (adds one) ++ increment
Decrement (subtracts one) -- decrement
Return the type of a variable as a string. Not applicable typeof
Binary Add, Concatenate + concat
Subtract - minus
Multiply * times
Divide / divide
Divide and floor (divide and round quotient down to an integer) // Not applicable
Modulus (find the remainder after dividing 2 numbers) % mod
Power of ^ pow
Logical AND && and
Logical OR || or
Convert a value to an ISEL data type (e.g. string, Boolean, numeric value). Not applicable as
Indicate what should occur when the condition is true and false (see the Conditional Expressions and Ternary Operators section below). ? [result when condition is true] : [result when condition is false] then [result when condition is true] else [result when condition is false]
Comparison Equal == equals
Not equal != not equals
Greater than > Not applicable
Greater than or equal >= Not applicable
Less than < Not applicable
Less than or equal <= Not applicable
Element in array or string Not applicable in

You can use the in operator to check for text in a string (e.g. "Green" in "Derek Greene") or an “array” element, or a group of values, (e.g. "Investigation" in ['Complaint', 'Investigation', 'Query'] or 'Investigation' in case.arrayField). However, use the == operator when you search an array of objects, called a collection (see the Collections section of this guide for more).

Conditional Expressions and Ternary Operators

You can use conditional expressions to define two different results when the system evaluates the expression based on the situation. Conditional expressions contain three segments in either of the following formats: 

condition ? if_true : if_false

or

if(condition) then if_true else if_false

In the condition segment, you enter a statement that can be found true or false. The system will check if the condition expression evaluates as true. If it is true, the second segment of your expression will be evaluated. If it is false, the system will skip over the second segment and evaluate the third segment instead. If you leave out the if_true section from your expression, the result of the condition segment will be returned instead.

For example, you could automatically set a case field as “High” priority if the case is set as confidential and “Low” priority when the case is not confidential. Supposing you had a radio, picklist, or text box field called “Priority” on the case form, you could create a “Set Field Value” rule action for the “Priority” field and enter the following into the “Expression” text box to accomplish this:

With this expression, the system will check if the case has been set as confidential, per the expression’s first segment. If so, it will refer to the second segment of the expression, which tells the system to set “Priority” as “High”. When the case is not confidential, the system will make sure “Priority” is “Low”.

You can create expressions with multiple conditions by either nesting multiple conditions in one conditional expression or using the ifeach function. Nested conditional expressions can return more than two different values. To nest a condition, enter it in the if_false segment of an expression. See the following nested conditional expression written out in two different formats as an example:

if(case.caseType equals "Case Type 1") then "High" else 
                                                                                        	if(case.caseType equals "Case Type 2") then "Medium" else 
                                                                                        		if(case.caseType equals "Case Type 3") then "Low" else ""

or

case.caseType == "Case Type 1" ? "High" : 
                                                                                        	(case.caseType == "Case Type 2" ? "Medium" : 
                                                                                        		(case.caseType == "Case Type 3" ? "Low" : "")
                                                                                        	)

This nested expression returns “High”, “Medium”, or “Low” based on one of three possible values of the “Case Type” field, which could be used to set a priority field by “Case Type” for example. 

You can use the ifeach function to create expressions where multiple conditions must be true to return a value (see the “String Functions” section in the ISEL Functions tab of this article for an explanation of each function argument). The example ifeach function below evaluates two conditions before returning a value: 

ifeach([case.confidential == true, case.caseType == 'Investigation'], 'High Priority', 'Low Priority')

This expression will return “High Priority” only when the case is both set to confidential and its “Case Type” is “Investigation”. “Low Priority” will be returned when the case is confidential or its “Case Type” is not “Investigation”.

Native Types

The following data types are built into ISEL. 

Types Examples
Booleans true, false
Strings "Hello "user"", 'Hey there!'
Numeric values 6, -7.2, -3.14159
Objects  {hello: "world!"}
Arrays ['hello', 'world!']

Groups

Use parentheses, (), to denote groups and control the order of operations for calculations. 

Expression Result
(83 + 1) / 2 42
1 < 3 && (4 > 2 || 2 > 4) true

Identifiers

Refer to variables of the object (i.e. fields on the form) by entering the object name, a period, and then the variable name. For example, case.caseType.

You can also refer to specific values of a variable using square brackets ([]) around the value in the expression. Enter the object name, a period, the variable name, an open square bracket, the variable’s value, and then a closed square bracket. For example, case.confidential[true]

You can use this syntax to identify specific values in an array, such as a picklist and its options. Suppose your application contained a picklist called “Location” with the following options: “Toronto”, “Montreal”, and “Vancouver”. The values in an array are ordered by number, starting at 0. The table below shows how you would identify each “Location” picklist option in an expression.  

Expression Result
case.location[0] Toronto
case.location[1] Montreal
case.location[2] Vancouver

Collections

You can filter any collections in your application by entering a filter expression in square brackets and referencing the properties of the collection using a period, i.e. object.collection[.variable in filter expression], which will result in an array of the objects for which the filter expression is true. If you want the result to be a single object variable, enter the variable following the filter expression: object.collection[.filter expression].variable

For example, attachment records in Case IQ contain a collection called “Files”. The “Files” collection includes the following objects:

name
                                                                                                        sizeBytes
                                                                                                        nameWithoutExtension
                                                                                                        encoding
                                                                                                        mimeType
                                                                                                        objectId
                                                                                                        description

If you wanted to pull a list of attached files that are over a certain file size, say 30 KB (or 30720 bytes), you would enter the following expression:

attachment.files[.sizeBytes > 30720]

This expression would return an array of all attached files that are over 30720 bytes, meaning that the name, bytes, etc. for each file that met the criteria would be pulled. If you just wanted a list of their file names, you would enter the following expression instead:

attachment.files[.sizeBytes > 30720].name
 
 

ISEL Functions

Most ISEL functions are “type agnostic”, meaning that they will work with numbers, arrays, strings, or Boolean types, so you do not have to check if the function type matches the value type you input. 

Apostrophes in Strings

The system can misinterpret apostrophes in string values as single quotation marks, meaning it will end the string at that point. There are 2 different ways you can indicate that the apostrophe is part of the string:

  1. Alternate single (') and double (") quotation marks in the string. For example, if you input "John's evidence" in an expression, the system will understand that the single quotation mark is an apostrophe.
  2. Use a backslash (\) before the apostrophe in the string. For example, you can enter 'John\'s evidence' in an expression and the system will recognize it as one string value.
 

String Functions

Function Description
concat(value 1, value 2, ...) Creates a new array or string by concatenating, or joining, the values together in the order they are inputted. You can input arrays, strings, or other objects as the values to join them as either as a single array or string. The returned value will be an array if at least one of the inputted values is an array. If two of the inputted values are strings, a string will be returned.
contains(object, value 1, value 2, ...) Determines if object contains value, returning a Boolean value. You can either input the form on which you are writing the expression or an array as object. If multiple value arguments are entered, the function will return true if object has any of the values and false if object does not contain any of the values.
count(value 1, value 2, ...) Returns the length of arrays or strings as a number. If multiple values are entered, the sum of each value’s length will be returned.
flatten(value) Takes an array of separate objects and combines them into one array object.
from(object 1, object 2) Returns the value of object 2 filtered from object 1 where they match. object 1 and object 2 can be objects or arrays. For example, from(['caseType'], case) will return the current value of the Case Type field.
has(object, field 1, field 2...) Determines if object contains field, returning a Boolean value. If multiple field arguments are inputted, the function will return true if object has any of the field arguments and false if object does not contain any of the field arguments.
ifeach([condition 1, condition 2, ...], if_true, if_false) Evaluates if each condition is true or false. If all conditions are true, the function’s result will be if_true. If at least one of the conditions evaluates as false, the function’s result will be if_false. You can enter one condition or an array of multiple conditions. For example, ifeach([case.confidential == true, case.caseType == 'Investigation'], 'High Priority', 'Low Priority') will return 'High Priority' when the case is set to confidential and as Investigation case type. However, 'Low Priority' will be returned when the case is not set to confidential or as Investigation case type.
isEmpty(value 1, value 2, ...) Looks at the value and determines if it is empty. It will return true if value is an empty array, string, object with no properties, null, or undefined. For all other scenarios, it will return false. If multiple values are inputted, the function will return true if all values are empty and false if all are not empty.
join(value 1, value 2, ..., separator) Combines a list of array or string values into a new string. separator is optional. You can choose to separate the values in the returned string with a string as the separator.
left(value, num) Creates a new array, string, or number on based the value and taking the number of elements in num starting from the left of the value. The returned value will be the same object type as the value and the value order of elements will be preserved. If value is a number, a number will be returned equaling the value divided by 10 to the power of num, effectively shifting the decimal place to the left.
lowerCase(value) Converts each letter in the value string to lower case. 
map(value, array 1, array 2) Returns a value from array 2 when value is equal to a value in array 1. The function will look at the position of value in array 1 and select array 2's value in the same position. For example, the expression map(case.department, ['Customer Service', ‘Operations’], ['1', ‘2’]) would return '1' when case.department is “Customer Service” and would return '2' when case.department is “Operations”.
padStart(value, num, padding) Adds the padding string to the beginning of the value string to be the length of the minimum number of characters in num. The function will continue to add padding until value is num characters long. You can use this to pad the case number sequence for a dynamic case number format expression. For example, the expression padStart(caseNumber.sequence, 4, '0') would return "0006" where the next case number in the sequence (caseNumber.sequence) is 6. The next value returned will be "0007".
properCase(value) Converts the first letter of each word in the value string to upper case and converts the subsequent letters in each word to lower case.
reduce(collection, property of collection) Reduces a collection (an array of objects) to one of its properties as an array. The function searches collection for the property of collection and returns only the property of collection values for each object in collection. For example, reduce([{id: 1, value: 5}, {id: 2, value: 10}], 'value') would return “[5, 10]”
reverse(value) Reverses the order of an array or the characters in a string. If the value is a positive number, it will be returned as a negative and vice versa for a negative value. If the value is Boolean, the opposite Boolean will be returned.
right(value, num) Creates a new array, string, or number based on the value and taking the number of elements in num starting from the right of the value. The returned value will be the same object type as the value and the value order of elements will be preserved. If value is a number, a number will be returned equaling the value multiplied by 10 to the power of num, effectively shifting the decimal place to the right.
slice(array, num 1, num 2) Returns part of array based on the start and end positions indicated by num 1 and num 2. The returned array will include all values in array from position num 1 to position num 2. By default, num 1 is 0 and num 2 is the length of array. For example, the expression slice(['1','2','3','4','5','6'],1,4) will return '2','3','4','5
split(value, separator, limit) Splits the value string into multiple elements of an array where the string matches the separator string.             
limit is optional. You can choose to restrict the number of elements to include in the array by entering a non-negative integer as the limit. If you provide a limit, the system will split value where separator occurs but will stop when limit number of elements are in the resulting array.
upperCase(value) Converts each letter in the value string to upper case. 

Math Functions

ISEL’s math functions are also type agnostic. However, the types of inputted values will be coerced into numbers for math following these rules:

  • The system will attempt to turn a string into a number. If it cannot, its value will default to 0. 
  • For Booleans, a true value will be converted to 1 and false to 0. 
  • The system will process each value of an array in an expression and return a new array. The new values will be outputted in the same order, except if the sum, subtract, multiply, and divide functions were used in the expression. For these functions, a single number will be calculated by performing the operation on each value of the array.

Number, Integer, and Money Field Limits

If you are entering an ISEL expression for a number, integer, or money type field, keep in mind the following field character limits:

  • Integer: maximum 15 digits.
  • Money: maximum 9 leading digits and 2 decimal digits.
  • Number: maximum 9 leading digits. For dynamic fields, you can set the number of decimal places a user is allowed to enter, with the maximum being 6.
 
Function Description
sum(value 1, value 2, ...) Add a series of values.
subtract(value 1, value 2, ...) Subtract a series of values. Values will be subtracted in the order they are entered in the expression.
multiply(value 1, value 2, ...) Find the product of a series of values.
divide(value 1, value 2, ...) Find how many times value 1 goes into value 2. If there are more than two values, the system will divide the values in the order they are entered in the expression.
mod(value 1, value 2)  Find the modulus, or the remainder after dividing value 1 into value 2.
abs(value) Find the absolute value of a number. Negative numbers will be converted to positive numbers, but positive numbers will not be changed.
min(value 1, value 2, ...) Find the lowest number within a series of values.
max(value 1, value 2, ...) Find the highest number within a series of values.
sqrt(value) Returns the square root of a value.
pow(value, exponent) Calculate  value to the power of exponent.
sin(value, useDegrees) Returns the trigonometric sine of value. useDegrees is optional. You can tell the system to output the result in degrees, by typing true in place of useDegrees, or to use radians, by typing false in place of useDegrees or leaving it blank.
cos(value, useDegrees) Returns the trigonometric cosine of value. useDegrees is optional. You can tell the system to output the result in degrees, by typing true in place of useDegrees, or to use radians by typing false in place of useDegrees or leaving it blank.
tan(value, useDegrees) Returns the trigonometric tangent of value. useDegrees is optional. You can tell the system to output the result in degrees, by typing true in place of useDegrees, or to use radians by typing false in place of useDegrees or leaving it blank.
log(value) Calculates the logarithm (base 10) of value.

Date Functions

ISEL has many unique functions for date type values. The functions that add to or subtract time from a date value will return a date value. For example, you can write the following expression to fill in a field with the date the case was created plus 2 days:

addDays(case.dateRecorded, 2)
Function Description
addYears(date value, years) Adds a number of years (years) to date value, which can be a variable or static value.
addQuarters(date value, quarters) Adds a number of quarters (quarters) to date value.
addMonths(date value, months) Adds a number of months (months) to date value.
addWeeks(date value, weeks) Adds a number of weeks (weeks) to date value.
addDays(date value, days) Adds a number of days (days) to date value.
addBusinessDays(date value, days) Adds a number of business days (days) to date value, meaning that the system will skip weekends and holidays when adding days.
addHours(date value, hours) Adds a number of hours (hours) to date value.
addMinutes(date value, minutes) Adds a number of minutes (minutes) to date value.
addSeconds(date value, seconds) Adds a number of seconds (seconds) to date value.
addMilliseconds(date value, milliseconds) Adds a number of milliseconds (milliseconds) to date value.
subtractYears(date value, years) Subtracts a number of years (years) from date value.
subtractQuarters(date value, quarters) Subtracts a number of quarters (quarters) from date value.
subtractMonths(date value, months) Subtracts a number of months (months) from date value.
subtractWeeks(date value, weeks) Subtracts a number of weeks (weeks) from date value.
subtractDays(date value, days) Subtracts a number of days (days) from date value.
subtractHours(date value, hours) Subtracts a number of hours (hours) from date value.
subtractMinutes(date value, minutes) Subtracts a number of minutes (minutes) from date value.
subtractSeconds(date value, seconds) Subtracts a number of seconds (seconds) from date value.
subtractMilliseconds(date value, milliseconds) Subtracts a number of milliseconds (milliseconds) from date value.
isBeforeDate(date value 1, date value 2, ..., reference) Checks if the date values are before the reference date. Returns separate true or false values for each date value inputted.
isSameDate(date value 1, date value 2, ..., reference) Checks if the date values are the same as the reference date. Returns separate true or false values for each date value inputted.
isAfterDate(date value 1, date value 2, ..., reference) Checks if the date values are after the reference date. Returns separate true or false values for each date value inputted.
isSameDateOrBefore(date value 1, date value 2, ..., reference) Checks if the date values are either the same date or before the reference date. Returns separate true or false values for each date value inputted.
isSameDateOrAfter(date value 1, date value 2, ..., reference) Checks if the date values are either the same date or after the reference date. Returns separate true or false values for each date value inputted.
isBetweenDates(date value 1, date value 2, ..., startDate, endDate) Checks if the date values are after the startDate and before the endDate. Returns separate true or false values for each date value inputted.
isLeapYear(date value 1, date value 2, ...) Checks if the date values occur during a leap year. Returns separate true or false values for each date value inputted.
millisecondsBetween(date value 1, date value 2) Calculates the number of milliseconds between date value 1 and date value 2. date value 1 will be subtracted from date value 2.
secondsBetween(date value 1, date value 2) Calculates the number of seconds between date value 1 and date value 2 . date value 1 will be subtracted from date value 2
minutesBetween(date value 1, date value 2) Calculates the number of minutes between date value 1 and date value 2. date value 1 will be subtracted from date value 2.
hoursBetween(date value 1, date value 2, useDecimals) Calculates the number of hours between date value 1 and date value 2. date value 1 will be subtracted from date value 2. useDecimals is optional. You can tell the system to output the result including partial hours (as decimals) by typing true in place of useDecimals or rounded to the nearest whole number of hours by typing false in place of useDecimals or leaving it blank.
daysBetween(date value 1, date value 2, useDecimals) Calculates the number of days between date value 1 and date value 2. date value 1 will be subtracted from date value 2. useDecimals is optional. You can tell the system to output the result including partial days (as decimals), by typing true in place of useDecimals or rounded to the nearest whole number of days by typing false in place of useDecimals or leaving it blank.
weeksBetween(date value 1, date value 2, useDecimals) Calculates the number of weeks between date value 1 and date value 2. date value 1 will be subtracted from date value 2. useDecimals is optional. You can tell the system to output the result including partial weeks (as decimals) by typing true in place of useDecimals or rounded to the nearest whole number of weeks by typing false in place of useDecimals or leaving it blank.
monthsBetween(date value 1, date value 2, useDecimals) Calculates the number of months between date value 1 and date value 2. date value 1 will be subtracted from date value 2. useDecimals is optional. You can tell the system to output the result including partial months (as decimals) by typing true in place of useDecimals or rounded to the nearest whole number of months by typing false in place of useDecimals or leaving it blank.
quartersBetween(date value 1, date value 2, useDecimals) Calculates the number of quarters between date value 1 and date value 2. date value 1 will be subtracted from date value 2. useDecimals is optional. You can tell the system to output the result including partial quarters (as decimals) by typing true in place of useDecimals or rounded to the nearest whole number of quarters by typing false in place of useDecimals or leaving it blank.
yearsBetween(date value 1, date value 2, useDecimals) Calculates the number of years between date value 1 and date value 2. date value 1 will be subtracted from date value 2. useDecimals is optional. You can tell the system to output the result including partial years (as decimals) by typing true in place of useDecimals or rounded to the nearest whole number of years by typing false in place of useDecimals or leaving it blank.
toDate(value, datetime format, strict)

Converts value from a string to a date. The function can accept different date formats entered in value, for example Jan 5 2020 or 2020-01-05. You can indicate a format to which the function should convert value by entering it in datetime format. For example, with the expression toDate(case.dateRecorded, 'MM-DD-YY'), the “Date Recorded” field will be converted to “MM-DD-YY” format. If you do not provide the datetime format argument, the system's default date and time format will be used.

With the strict argument, you can indicate if the system can make inferences when parsing the string into a date value. If you enter true in place of strict, the system can only format value using the information passed into the function and will not make any inferences. To allow the system to make inferences, enter false in place of strict or leave it blank. 

format(value, datetime format, timezone)

Converts value into another date and/or time format and timezone. datetime format and timezone are optional. If you do not provide either argument, the system's default date and time format and timezone will be used. When including a timezone, use the timezone's TZ identifier, such as America/Toronto or Europe/London (see a list of TZ database time zones on Wikipedia). This function allows you to convert date and datetime values in many ways:

  • Convert a date to another format, e.g. format('January 13 2021', system.defaultDateFormat) would return '13-Jan-2021'. If you do not indicate a timezone, the system default will be used to calculate the date.
  • Change a short datetime to the full date and time written out, e.g. format('2022-11-30 6:00 AM', ‘dddd, MMMM Do YYYY, h:mm a’)January 13 2021', system.defaultDateFormat) would return 'Wednesday, November 30th 2022, 3:00 am'.
  • Convert a datetime to another timezone, e.g. format('13-Dec-2022 12:00 AM', system.defaultDateTimeFormat, 'America/Vancouver') returns ‘12-Dec-2022 4:00 PM’
  • Only include the time of a datetime, e.g. format('2022-11-30 6:00 AM', system.defaultTimeFormat, 'America/Toronto') returns '6:00 AM'.
isDate(value 1, value 2, ...) Checks if value is a valid date type. Returns true if all values are dates and false if they are not. Both date and strings containing date text are accepted.
onSameDay(value 1, value 2, ...) Checks if value 1 is the same date as value 2. Returns true if all date values occur on the same day and false if at least one does not. 
onSameWeek(value 1, value 2, ...) Checks if value 1 is within the same calendar week as value 2. Returns true if all date values occur in the same calendar week and false if at least one does not. 
onSameMonth(value 1, value 2, ...) Checks if value 1 is within the same calendar month as value 2. Returns true if all date values occur in the same calendar month and false if at least one does not. 
onSameYear(value 1, value 2, ...) Checks if value 1 is during the same calendar year as value 2. Returns true if all date values occur during the same calendar year and false if at least one does not. 

Transform Expressions

You can transform expressions to write it in a different format, allowing you to use multiple functions in a single row. Use the transform pipe character, |, to transform an expression following this order of elements: 

object.variable | function(value)

Instead of the function formats outlined in the String Functions, Math Functions, and Date Functions sections, you can use the transformed format to write the same expression. For example, to add days to the date the case was created (dateRecorded), you can either write: 

or

You can also combine multiple functions in a single expression using the transform syntax, i.e. object.variable | function1(value) | function2(value) | function3(value). Functions will be evaluated in the order entered in the expression. For example, in the expression case.number | sum(4) | multiply(5), the system would add 4 to the number variable, then multiply it by 5.

 
 

Context Objects

ISEL has implicit context, meaning that the objects you can refer to in expressions are already identified by the system and you do not need to create a context for your expression. When writing your expression, the object available is the form on which the field you are creating the expression is located. 

Now Object

now is a simple object that does not have variables. Enter now in an expression to refer to the current date and time a form was saved or the Set Field Value rule was triggered.

System Object

The system object contains basic information about the Case IQ application in which you are working. You can use system and its variables, which are listed below, just like the form objects used in this guide’s examples so far. 

Variable Description
defaultLanguage The language your application uses by default.
defaultTimezone             
 
Your application’s time zone by location.
name Your application’s name. Usually, this is the name of your company.
supportEmail The support email address of your application.
version The configuration version of your application.
defaultDateFormat The default date format of your application, generally “DD-MMM-YYYY”.
defaultDateLongFormat The default longer date format, including the full month name, of your application, generally “MMMM D, YYYY”.
defaultDateTimeFormat The default date and time format of your application, generally “DD-MMM-YYYY h:mm A”.
defaultDateTimeLongFormat The default longer date and time format, including the full month name, of your application, generally “MMMM D, YYYY h:mm A”.

User Object

The user object allows you to contextually refer to the last user account that updated a record. For example, you could enter user.email in an expression to fill in a field with the email address of the last person who updated a case. The table below contains all variables of user.

Variable Description
email The user account’s email address.
firstName The user account’s first name
id The system-generated ID the application created for the account. This will not show the User ID that the individual uses to log in to Case IQ.
language The language in which the application is displayed for the user account.
lastName The user account’s last name.
Signature The email signature added to the end of their emails sent from Case IQ.
userRoleID The system-generated ID the application created for the account’s user role. Use userRoleID__name for the plain language user role name as it is shown on the User Role’s page.
userRoleID__name The account’s user role in plain language.

Math Object

In addition to the form objects, you will also be able to use the math object. You can use the math object to perform arithmetic using mathematical constants, such as pi. Just like form objects in ISEL, you do not need to construct or set up the math object, meaning that you can get started using it in expressions right away. For example, to refer to pi, enter the following in your expression:

The following properties are available for the math object in ISEL:

Function Description Approximate Number
E Returns Euler's number. 2.718
LN2 Returns the natural logarithm of 2. 0.693
LN10 Returns the natural logarithm of 10. 2.302
LOG2E Returns the base-2 logarithm of E. 1.442
LOG10E Returns the base-10 logarithm of E. 0.434
PI Returns PI. 3.14
SQRT1_2 Returns the square root of ½. 0.707
SQRT2 Returns the square root of 2. 1.414

This and Field Objects

The this and field objects allow you to contextually refer to the entity for which you are creating the expression. For example, when creating a “set field value” rule action, you can use the field object to refer to the properties of the field that will be set by the rule, including its caption, name, type, and value. Entering field.caption will return the field's caption text.

The field object will only be available when you are creating an expression for a field, such as  “set field value” rule actions, computed fields, and aggregate fields. You can use the this object instead to pull the same information, for example, when writing an expression for the case number format. When typing in the “Expression” field on the Case Number page in Settings, entering this.prefix will return the prefix set as the case number format.