Appverse Expressions

Current value

. (dot)

Referencing a Form Field

  • ${} - Returns the value of field enclosed within {}

    • Example - ${firstname} will return 'John' if John was entered in the firstname field

Functions

String Functions

  • String Functions

Function
Description
Example

concat(string1, string2, ...)

Joins multiple strings into one.

concat('Name', ' : ', ${firstname}) → "Name : John"

string-length(string)

Returns the length of a string.

string-length(${firstname}) → 4 (if ${firstname} = "John")

substr(string, start, length)

Extracts a substring from a string.

substr('hello', 1, 3) → "hel"

translate(string, from, to)

Replaces characters in a string.

translate('abc', 'a', 'x') → "xbc"

join(delimiter, string1, string2, ...)

Combines data from multiple fields into a single string.

join(' ', ${first_name}, ${middle_name}, ${last_name}) -> "John M Smith" if John is the first_name, M is the middle_name and Smith is the last_name

  • Date and Time Functions

Function
Description
Example

today()

Returns the current date.

today() → 2025-01-22

now()

Returns the current date and time.

now() → 2025-01-22T14:30:00

format-date(date, format)

Formats a date into a string.

format-date(today(), '%Y-%m-%d') → "2025-01-22"

decimal-date-time(date)

Converts a date-time to a decimal number (days since Jan 1, 1970).

decimal-date-time(today()) → 19848.0

date(date_string)

Converts a string into a date object.

date('2025-01-22') → 2025-01-22

time(time_string)

Converts a string into a time object.

time('14:30:00') → 14:30:00

  • Mathematical Functions

Function
Description
Example

abs(number)

Returns the absolute value.

abs(-5) → 5

ceil(number)

Rounds a number up to the nearest integer.

ceil(4.2) → 5

floor(number)

Rounds a number down to the nearest integer.

floor(4.9) → 4

round(number, decimals)

Rounds a number to a specific decimal place.

round(4.567, 2) → 4.57

int(number)

Converts a number to an integer.

int(4.9) → 4

pow(base, exponent)

Raises a number to a power.

pow(2, 3) → 8

mod(number, divisor)

Returns the remainder of a division.

mod(10, 3) → 1

sum(repeat-group)

Sums a set of values in the repeat group field or list of numbers

sum(${receivableamount}) $receivableamount is a field in a repeat group

avg(repeat-group)

Calculates the average of a set of values in the repeat group field or list of numbers

avg(${receivableamount}) $receivableamount is a field in a repeat group

count(repeat-group)

Counts the number of instances of a repeat group

sum(${rptgrpmembers}) $rptgrpmembers is a repeat group in the form

min(repeat-group)

Min of the values of a repeat group field

min(${receivableamount}) $receivableamount is a field in a repeat group

max(repeat-group)

Max of the values of a repeat group field

max(${receivableamount}) $receivableamount is a field in a repeat group

sum-if(

Sums a set of values in the repeat group field or list of numbers based on a condition

sum-if (${receivableamount}, ${receivableamount} > 1000) $receivableamount is a field in a repeat group

  • Logical Functions

Function
Description
Example

if(condition, true_value, false_value)

Returns one value if the condition is true, otherwise another value.

if(${age} > 18, 'Adult', 'Minor')

coalesce(value1, value2, ...)

Returns the first non-empty value.

coalesce(${name}, 'Unknown')

  • Comparison and Boolean operators

Function
Description
Example

boolean(value)

Converts a value to boolean (true/false).

boolean(1) → true

not(expression)

Returns the opposite boolean value.

not(${consent_given})

and(expression1, expression2, ...)

Returns true if all conditions are true.

and(${age} > 18, ${consent} = 'yes')

or(expression1, expression2, ...)

Returns true if at least one condition is true.

or(${age} > 18, ${guardian_consent} = 'yes')

  • Instance Functions

Function
Description
Example

count(node-set)

Counts the number of repeated group instances.

count(/data/repeat_group)

position()

Returns the index of the current repeat group instance.

position() = 1 (first instance)

indexed-repeat(field, group, index)

Retrieves a field value from a specific repeat group instance.

indexed-repeat(${name}, /data/repeat_group, 2)

  • Geographic Functions

Function
Description
Example

distance(lat1, lon1, lat2, lon2)

Calculates the distance (in meters) between two points.

distance(${lat1}, ${lon1}, ${lat2}, ${lon2})

area(node-set)

Computes the area of a polygon or shape.

area(${polygon})

  • Selection Functions

Function
Description
Example

uuid()

Generates a unique identifier.

uuid() → "123e4567-e89b-12d3-a456-426614174000"

digest(string, algorithm)

Returns a hash of the string using the specified algorithm (e.g., sha1).

digest('password', 'sha1')

jr:choice(field, value)

Used to retrieve the description (label) of the selected list value

jr:choice($gender, 'male') will return Male

count-selected(list)

Counts the number of selected choices

count-selected(${members})

selected(value, list)

Checks if a value is selected in a multi-select question.

selected(${gender}, 'male')

selected-at(list, index)

Returns the selected item at a given index.

selected-at(${gender}, 1)

Common Date Formats

Format String
Example (for 2025-01-22)
Description

'%Y-%m-%d'

2025-01-22

Year-Month-Day (ISO 8601)

'%d-%m-%Y'

22-01-2025

Day-Month-Year

'%m/%d/%Y'

01/22/2025

Month/Day/Year

'%b %d, %Y'

Jan 22, 2025

Abbreviated month name

'%B %d, %Y'

January 22, 2025

Full month name

'%y-%m-%d'

25-01-22

Two-digit year

'%a, %d %b %Y'

Wed, 22 Jan 2025

Abbreviated weekday name

'%A, %d %B %Y'

Wednesday, 22 January 2025

Full weekday name

Time Formatting

Format String
Output Example (14:30:45)
Description

'%H:%M:%S'

14:30:45

24-hour time (HH:MM:SS)

'%I:%M %p'

02:30 PM

12-hour time with AM/PM

'%H:%M'

14:30

24-hour time without seconds

Last updated