NexJ Logo

Formula data types

Types are the different kinds of data values that can be used in field control formulas. When you enter information in a form field, pull it from an approval object field, or return it as the result of an expression, the value is expressed as a defined data type.

All data values are expressed as the one of following types:

Boolean

Booleans are values that are either true or false.

Boolean values are typically the result of logical expressions. For example, the expression 5 < 10 returns the Boolean value TRUE, and the expression 5 > 10 returns the Boolean value FALSE.

Boolean values are typically used in expressions when you want to perform a logical operation. For example, the expression If(<statement>, "Do this", "Do that") returns either "Do this" or "Do that", depending on whether statement evaluates to true or false.

Date

Dates are timestamp values that represent a specific date and time. Date values differ from dates written as text because date values can be created, modified, and formatted using defined functions.

Because date values are stored in forms and contact profiles as timestamps, they are not formatted in a way that can be easily read by most people. To see a date value in a more common format, you must either pass it to a date field in a form, or format it as a string value using a date function.

Date values are typically entered in date fields on a form, or they can be pulled from objects that contain a date value. For example, the @birthTime field contains a date value to represent a date of birth.

Integer

Integers are whole numbers that do not include a decimal place. For example, the value 2 is an integer, while 2.0 is not.

When used only with other integers in a calculation, if the result does not contain a fractional component, the returned number will be an integer. For example, the expression 2 + 2 returns 4. If the result contains a fractional component, the returned number will instead be a decimal number. For example, the expression 5 / 2 returns 2.5.

When used with a decimal number in a calculation, the result will be a decimal number. For example, the expression 2 + 2.0 returns 4.0.

Number

Numbers are numeric values that include a decimal place. They can be either whole numbers or numbers that contain a fractional component. For example, the values 2.0 and 2.1 are both numbers.

When used with numbers or integers in a calculation, the result will be a number. For example, the expression 2 + 2.0 returns 4.0.

String

Strings are sequences of characters that represent text. They are made by placing text within double quotation marks. For example, the value "Hello World!" is a string.

Strings may contain letters, numbers, and symbols. The symbols " and \ are special characters that cannot be written directly in a string. If you want to write a double quotation mark in a string, use the token \". If you want to write a backslash in a string, use the token \\.