General functions
These functions display list items for use in testing or in displays to respondents. They can be used in any field.
getListItemLabel
Returns a single list item's label to the page if it exists in the list. Can be used for testing, or to display items to a respondent. If the specified position does not exist in the list, undefined is returned at the script location.
Function: getListItemLabel(listName: string, position: number): string
Example: {{getListItemLabel("Q1List", 1)}}
Result: The label of the item at position 1 in Q1List.
getListItemNumber
Returns a single list item's source number to the page if it exists in the list. Can be used for testing, or to display items to a respondent. If the specified position does not exist in the list, undefined is returned at the script location.
Function: getListItemNumber(listName: string, position: number): number
Example: {{getListItemNumber("MyDynamicList", 1)}}
Result: The source list item number of the item currently in position 1 of MyDynamicList. For example, if position 1 in MyDynamicList is item 4 in the source list, this function returns 4.
getListItemLabelsArray
Returns the item text of all items in the specified list as a JavaScript array, useful for scripting and custom logic.
Function: getListItemLabelsArray(listName: string): string[]
Example: {{getListItemLabelsArray("Q1List")}}
Return: The item text of all the items in the specified list, separated by commas.
getListItemNumbersArray
Returns the item values of all items in the specified list as a JavaScript array, useful for scripting and custom logic.
Function: getListItemNumbersArray(listName: string): string[]
Example: {{getListItemNumbersArray("Q1List")}}
Return: The item values of all the items in the specified list, separated by commas.
printListItemLabelsArray
Returns the item text of all items in the specified list as a formatted string, useful for displaying text directly to a respondent (e.g. in a question or message). Items are separated by commas and spaces.
Function: printListItemLabelsArray(listName: string): string
Example: {{printListItemLabelsArray("Q1List")}}
Return: The item text of all the items in the specified list, separated by commas and spaces.
printListItemNumbersArray
Returns the item values of all items in the specified list as a formatted string, useful for displaying text directly to a respondent (e.g. in a question or message). Items are separated by commas and spaces.
Function: printListItemNumbersArray(listName: string): string
Example: {{printListItemNumbersArray("Q1List")}}
Return: The item values of all the items in the specified list, separated by commas and spaces.
