Complex Questions in Expressions
Complex questions can contain more than one value. Such questions include Single-, Multi-Select, and Dynamic Matrices, Dynamic Panels, and Multiple Textboxes questions. This example demonstrates how to access different values within complex questions.
To access a value from outside a complex question, use the question's name and the name of its element (item, row, column) to which the value belongs:
Question Type | Syntax |
---|---|
Multiple Textboxes | {questionname.itemname} |
Single-Select Matrix | {questionname.rowname} |
Multi-Select Matrix | {questionname.rowname.columnname} |
{questionname-total.columnname} (accesses a cell in the total row) |
This demo shows a Multiple Textboxes question that asks users to enter contact details, including an email address. Under this question, the form displays an "I agree to receive newsletters" checkbox, which is visible only if an email address is provided. This checkbox is a Yes/No (Boolean) question. Its visibleIf
expression accesses the email address input field of the Multiple Textboxes question using the notation from the table above.
To access a value (question or cell) within a Dynamic Panel or Dynamic Matrix from outside, use a zero-based index:
Question Type | Syntax |
---|---|
Dynamic Panel | {dynamicpanelname[index].questionname} |
Dynamic Matrix | {dynamicmatrixname[rowindex].columnname} |
To access a cell or question from inside a matrix or panel, use the row
, panel
, and parentPanel
prefixes:
Question Type | Syntax | Action |
---|---|---|
Single-Select Matrix, Multi-Select Matrix, Dynamic Matrix | {row.columnname} |
Accesses a cell in the same row. |
{rowName} |
Accesses the row name (the value property within objects in the rows array). Use this placeholder if you need to distinguish between matrix rows. |
|
Dynamic Panel | {panel.questionname} |
Accesses a question within the same panel. |
{parentPanel.questionname} |
Accesses a question within a parent Dynamic Panel. Applies when one Dynamic Panel question is nested in another. |
In this demo, the row
prefix is used to calculate totals in each matrix row and enable or disable the Quantity column cells based on a condition. Refer to the json.js
file for code examples.