Loop and Merge

Edit in →
Survey Creator

Loop and Merge is a feature that allows you to repeat a group of questions and combine the responses into one data object. The loop can either iterate over the same set of questions for each item or adjust dynamically based on user input. In this example, you can select one or multiple SurveyJS products, and the survey will then ask a series of repeating questions about each selected product.

Supported Question Types

A question loop can be created using one of the complex question types:

Single- and Multi-Select Matrices produce a predefined number of loops—one for each matrix row. In contrast, Dynamic Matrix and Dynamic Panel types allow users to add new entries during the survey, generating new loops on the fly.

Configure the Loop

Loop and Merge requires the survey structure to change and display only one input field per survey page. To enable this structure, set the questionsOnPageMode property to "inputPerPage" at the survey level.

If you are implementing a loop based on a matrix, the matrix rows represent items, and the columns represent the questions to iterate over. You can manage which loops are included or excluded by controlling row visibility with the rowsVisibleIf expression. In this demo, we use the rowsVisibleIf expression to filter out unselected SurveyJS products.

Each loop step also displays a view title. In Multi-Select and Dynamic Matrices, you can customize the title using the singleInputTitleTemplate property. This property supports dynamic placeholders ({rowIndex}, {rowName}, and {rowTitle}) and text piping from neighboring matrix cells and other questions.

If you are using a Dynamic Panel for the loop, define the set of questions to repeat inside the panel template. Refer to the following example for more details: Breakable Loop.

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.