Expressions in Dynamic Panel

Edit in →
Survey Creator

Expressions let you configure conditional logic to create dynamic surveys. You can use expressions to implement branching and skip logic, dynamically show and hide questions, mark them as required, enable and disable them, and perform calculations right in the survey JSON schema. This example demonstrates expressions in a Dynamic Panel. Here expressions are used to calculate employment duration. Enter a company name and employment dates to see the number of days employed for this company. You can add as many companies as you want—days employed will be added up and displayed under the Dynamic Panel.

Access Questions Within a Panel

To reference questions within the same panel in your expressions, use the panel prefix as follows: {panel.questionName}. Refer to the expressions within the Employment History panel for code examples.

Dynamically Calculate Values

Expressions support built-in functions and allow you to create custom functions for in-survey calculations. In this demo, expressions calculate the number of days employed using built-in diffDays and sumInArray functions. For more information on how to use these and other built-in functions or how to implement a custom function, refer to the Expressions help topic.

Manage Question Visibility

You can use expressions to implement conditional visibility for questions, choice options, matrix columns/rows, and other elements. In this demo, the number of days for individual companies is only displayed when you enter both the company name and employment dates. To implement this functionality, assign a Boolean expression to the visibleIf property. You can find more details in the Conditional Visibility help topic.

Validate Question Values

Expressions can be used to add data validation to your survey. In this example, the Employment Dates question fields use the minValueExpression and maxValueExpression properties to ensure that the end date falls within the range between the selected start date and the current date. For more information about data validation in SurveyJS Form Library, refer to the following help topic: Data Validation.

Your cookie settings

We use cookies on our site to make your browsing experience more convenient and personal. In some cases, they are essential to making the site work properly. By clicking "Accept All", you consent to the use of all cookies in accordance with our Terms of Use & Privacy Statement. However, you may visit "Cookie settings" to provide a controlled consent.

Your renewal subscription expires soon.

Since the license is perpetual, you will still have permanent access to the product versions released within the first 12 month of the original purchase date.

If you wish to continue receiving technical support from our Help Desk specialists and maintain access to the latest product updates, make sure to renew your subscription by clicking the "Renew" button below.

Your renewal subscription has expired.

Since the license is perpetual, you will still have permanent access to the product versions released within the first 12 month of the original purchase date.

If you wish to continue receiving technical support from our Help Desk specialists and maintain access to the latest product updates, make sure to renew your subscription by clicking the "Renew" button below.