> For the complete documentation index, see [llms.txt](https://help.metaforms.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.metaforms.ai/survey-programming-decipher/complexity-support/loops.md).

# Loops

Metaforms supports a wide range of Loops in your surveys.

Let's take a look at all of them:

* **Normal loop which shows some questions for brand list and the brand name is piped in those questions without any condition.**

  \
  ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-c35d3523015846c024183be5cdac04779c2aba22%2Fcomplexity-loops-loop26-01.png?alt=media)\
  \
  ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-bd5b97754f2b496b02e5b44d4f8b1db690dfe6c2%2Fcomplexity-loops-loop26-02.png?alt=media)<br>
* **Loop which shows some questions for the brand list and the brand name is piped in those questions and the loop is run only for the options selected in a previous multi select question.**\
  \
  **Base checkbox question.**\
  \
  ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-d7c81e219fae666ffbda44c1b52df5880cb4e5a5%2Fcomplexity-loops-loop26-03.png?alt=media)\
  \
  **Loop with two questions which are iterated for the option selected in the base checkbox question.**\
  \
  ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-47039d77b0832614d33cb80c373d39f361c68fb4%2Fcomplexity-loops-loop26-04.png?alt=media)\
  \
  ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-4b74b3099d945055b8360c72c91d910e6b875bd1%2Fcomplexity-loops-loop26-05.png?alt=media)<br>
* **Loop with randomised iterations where one of the iterations is anchored.**\
  \
  ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-1c0fc7bfa5f40035d16fdb4746767988752ebd71%2Fcomplexity-loops-loop26-06.png?alt=media)<br>
* **Loop with iterations randomised based on the question outside of the loop.**
  * Base question from which the order of the loop will be controlled based on how the options are randomised in this question\
    \
    ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-ac6474c76e324a42f50924aa3c592a305e2b0d10%2Fcomplexity-loops-loop26-07.png?alt=media)
  * Loop for which the randomisation order is maintained from the base question\
    \
    ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-420a2a905b3ecb24326db3314c24d4a201a7fdfd%2Fcomplexity-loops-loop26-08.png?alt=media)<br>
* **Loop with multiple loop variable to pipe the text.**
  * **Example** - Knowledge and Tagline Fit (Publisher + Tagline Pairs)<br>

    ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-85d4f82c59598179aa6086b1ac5aaf4eb3c5259e%2Fcomplexity-loops-loop26-09.png?alt=media)\
    \
    ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-566f4133be96a88e17b649ce4d4a052f07aac44a%2Fcomplexity-loops-loop26-10.png?alt=media)<br>
* **Loop with condition some loop iterations only.**
  * Before loop there are few radio questions as below.\
    \
    ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-8a4f74cdc68fe55059c958e0cb2c6f32b153b751%2Fcomplexity-loops-loop26-11.png?alt=media)\
    \
    ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-c3649ceac4caa9ad8fe9b4720da9403bc39e5275%2Fcomplexity-loops-loop26-12.png?alt=media)<br>
  * Some iterations of the loop with condition based on previous question.

    \
    ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-c7c955c7dc09d6e07b4200e533d0ae7d7b0f21e9%2Fcomplexity-loops-loop26-13.png?alt=media)<br>
* **Question inside Loop with conditions on the options based on the loop iteration implementing this logic using looprows attribute in rows.**\
  \
  **Example**: Timings are displayed based on the type of the book\
  \
  ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-90fd1686cad66bdcc9e53bd2093412ee65e7bf4c%2Fcomplexity-loops-loop26-14.png?alt=media)\
  \
  ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-f382fdff3d8267a8f364dfde3a8537236c7de38d%2Fcomplexity-loops-loop26-15.png?alt=media)\
  \
  ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-d975337f9a048873b1650d06fad3bfff725ee3ff%2Fcomplexity-loops-loop26-16.png?alt=media)\
  \
  ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-e012082bb8951fc65340f695aa7c86a2f7f978d8%2Fcomplexity-loops-loop26-17.png?alt=media)<br>
* **Loop iteration shown based on the least fill logic of previous checkbox question.**

  \
  ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-fc9bcf582496deada3d4d1e0332e4464bf67ed05%2Fcomplexity-loops-loop26-18.png?alt=media)\
  \
  ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-a0ecfd10b7283cd31a83aad72bd6ab4f8af8af12%2Fcomplexity-loops-loop26-19.png?alt=media)\
  \
  Along with the main loop, below are the nested loop where options are shown based on the which iteration is currently running in the outer loop and inner loop.\
  \
  ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-dcb68fdb0a81cd0db56643d0fea1dfc35e5790e5%2Fcomplexity-loops-loop26-20.png?alt=media)\
  \
  ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-3a77b6a2ad5f460e25e92d11e815e7752d759ba8%2Fcomplexity-loops-loop26-21.png?alt=media)<br>
* **Nested loop with the below logic implemented**
  * Multi-select checkbox question with different types of vehicles.\
    \
    ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-bf1c70e7081b21999f2249fe5b751fa23e90c077%2Fcomplexity-loops-loop47-01.png?alt=media)<br>
  * Based on previous multi-select checkbox question, we have main loop which is asked based on the selected vehicles type.\
    \
    ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-6a157ae1eed79ad0caa8cab3b3f100098bb7b95a%2Fcomplexity-loops-loop47-02.png?alt=media)<br>
  * Inside the main loop, there is a numeric question where the vehicle type appears in the question text, and different vehicle models are shown as options based on the vehicle types selected in the previous checkbox question.\
    \
    ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-df873e9713b381170277d1e09647b51143cd9e1d%2Fcomplexity-loops-loop47-03.png?alt=media)<br>
  * Inside the main loop there is inner loop based on the vehicle models, which is shown if vehicle model has value more then zero at the previous number question.\
    \
    ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-4fcdf6178c73d97b3a812189fe32595998e44771%2Fcomplexity-loops-loop47-04.png?alt=media)<br>
  * For inner loop there are number and radio question, where value from previous number question and vehicle model text are shown in the question text.

    \
    ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-4608538b55d7fbac53c48711cd18f245a04c7d33%2Fcomplexity-loops-loop47-05.png?alt=media)\
    \
    ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-d6fb62ec985feafc8c2d474560f79b79908fd11a%2Fcomplexity-loops-loop47-06.png?alt=media)

<br>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.metaforms.ai/survey-programming-decipher/complexity-support/loops.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
