×
Menu
Index

Built-in Functions

 

iif

Definition: iif(condition: expression, valueIfTrue: any, valueIfFalse: any): any
Returns the valueIfTrue value if the condition is true or the valueIfFalse value if the condition is false.
Example: "expression": "iif({question1} + {question2} > 20, 'High', 'Low')"
 

isContainerReady

Definition: isContainerReady(nameOfPanelOrPage: string): Boolean
Returns true if all questions in a given panel or page have valid input; otherwise, returns false. An empty question value is considered valid if neither validators nor required status is defined for it.
Example: "expression": "isContainerReady('page1')"
 

isDisplayMode

Definition: isDisplayMode(): Boolean
Returns true if the survey is in display or preview mode.
Example: "expression": "isDisplayMode()"
 

age

Definition: age(birthdate: any): number
Returns age according to a given birthdate. The date argument (which is typically taken from a question) should be defined as a valid JavaScript Date.
Example: "expression": "age({birthdate})"
 

currentDate

Definition: currentDate(): Date
Returns the current date and time.
Example: "expression": "currentDate()"
 

today

Definition: today(daysToAdd?: number): Date
Returns the current date or a date shifted from the current by a given number of days. For example, today() returns the current date, 0 hours, 0 minutes, 0 seconds; today(-1) returns yesterday's date, same time; today(1) returns tomorrow's date, same time.
Examples:
 

getDate

Definition: getDate(questionName: expression): Date
Returns a Date value converted from a given question's value.
Example: "expression": "getDate({birthdate})"
 

diffDays

Definition: diffDays(fromDate: any, toDate: any): number
Returns the number of days between two given dates.
Example: "expression": "diffDays({startDate}, {endDate}) < 7"
 

sum

Definition: sum(param1: number, param2: number, ...): number
Returns the sum of passed numbers.
Example: "expression": "sum({total1}, {total2})"
 

max

Definition: max(param1: number, param2: number, ...): number
Returns the maximum of passed numbers.
Example: "expression": "max({total1}, {total2})"
 

min

Definition: min(par1: number, par2: number, ...): number
Returns the minimum of passed numbers.
Example: "expression": "min({total1}, {total2})"
 

avg

Definition: avg(par1: number, par2: number, ...): number
Returns the average of passed numbers.
Example: "expression": "avg({total1}, {total2}, {total3})"
 

sumInArray

Definition: sumInArray(questionName: expression, propertyName: string): number
Returns the sum of numbers in an array taken from a given question property.
Example: "expression": "sumInArray({matrixdynamic1}, 'total') > 1000"
 

maxInArray

Definition: maxInArray(questionName: expression, propertyName: string): number
Returns the maximum of numbers in an array taken from a given question property.
Example: "expression": "maxInArray({matrixdynamic4}, 'quantity') > 20"
 

minInArray

Definition: minInArray(questionName: expression, propertyName: string): number
Returns the minimum of numbers in an array taken from a given question property.
Example: "expression": "minInArray({matrixdynamic3}, 'quantity') > 5"
 

avgInArray

Definition: avgInArray(questionName: expression, propertyName: string): number
Returns the average of numbers in an array taken from a given question property.
Example: "expression": "avgInArray({matrixdynamic2}, 'quantity') > 10"
 

countInArray

Definition: countInArray(questionName: expression, propertyName: string): number
Returns the total number of items in an array taken from a given question property.
Example: "expression": "countInArray({matrixdynamic5}) > 10"