> 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/datasource.md).

# Datasource

Metaforms supports a wide range of Data Source Setups in your surveys.

Let's take a look at all of them:

**Datasource setup using variable declared in the extraVariables attribute of survey tag.**\
\
Maps survey variables defined in the extraVariables attribute of the survey tag to datasource fields for data retrieval and pre-population.

Match source from URL with ID in dataset.

* **Mapping Process:**
  * Survey Variable: source (defined in extraVariables attribute)
  * Dataset Field: ID (unique identifier in external datasource)
  * Functionality: Matches the source value from URL parameters with corresponding ID
* **Example Flow:**
  * Survey URL contains: \`?source=12345\`
  * System searches datasource for record where \`id=12345\`
  * Retrieved data pre-populates designated survey questions
* **Auto populate text question from the datasource**

  \
  ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-5529300f82b2739da04fd61246aed5a2227dc895%2Fcomplexity-datasource-ds41-01.png?alt=media)<br>
* **Auto populate text question with rows from datasource**\
  \
  ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-17e26e1e8904bfcbb7f97aa096a28309887fe68f%2Fcomplexity-datasource-ds41-02.png?alt=media)<br>
* **Auto populate number question from datasource**\
  \
  ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-39c2b67761c485542dc9e8fea012afa8e925fe8d%2Fcomplexity-datasource-ds41-03.png?alt=media)<br>
* **Auto populate number question with rows from datasource**

  \
  ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-b312fa2d4d55777f179d455093fe44b27cb5f13c%2Fcomplexity-datasource-ds41-04.png?alt=media)
* **Auto populate float question from datasource**\
  \
  ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-a3f29006edcaf76474730b2d32acce1dff70d71c%2Fcomplexity-datasource-ds41-05.png?alt=media)
* **Auto populate number question with rows from datasource**\
  \
  ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-1283dbb8a09dce612957cf310e65f4b458dd9d75%2Fcomplexity-datasource-ds41-06.png?alt=media)<br>
* **Auto populate radio question with rows from datasource**\
  \
  ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-cff304e8dd4ab4ad61e3e2b74d5f5900c41315a3%2Fcomplexity-datasource-ds41-07.png?alt=media)<br>
* **Auto populate radio question with columns from datasource**

  \
  ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-3a4e177089ef0232a8f36819413ccbfc2344e3ae%2Fcomplexity-datasource-ds41-08.png?alt=media)<br>
* **Auto populate radio question with rows and columns from datasource**

  \
  ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-70b1dd14c942a856aac13ae1abe7f0d089c2bc67%2Fcomplexity-datasource-ds41-09.png?alt=media)<br>

**Datasource Setup using variable declared in one of the sample source in survey**

Maps sample source variables to datasource fields for data retrieval and pre-population survey questions.

* **Mapping Process:**
  * Sample Source Variable: userId (from sample source tag)
  * Dataset Field: userId (unique identifier in dat file used for datasource file)
  * Functionality: Matches userId from sample source with corresponding userId in external datasource
* **Example Flow:**
  * Sample source variable contains: \`userId=ABC123\`
  * System searches dat file used in the datasource for record where \`userId=ABC123\`
  * Retrieved data auto-punches designated survey questions
* **Auto populate text question from datasource using sample source variable**\
  \
  ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-e9fe936f164fcf6ed753e042d477fd058f2f86af%2Fcomplexity-datasource-ds42-01.png?alt=media)<br>
* **Auto populate text question with rows from datasource using samplesource variable**\
  \
  ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-0265493d319ccdf39380d6b92cb824cacd631309%2Fcomplexity-datasource-ds42-02.png?alt=media)<br>
* **Auto populate number question from datasource using samplesource variable**\
  \
  ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-b3a13ce7501fbb9072134dee335e3a618b629a8a%2Fcomplexity-datasource-ds42-03.png?alt=media)
* **Auto populate number question with rows from datasource using samplesource variable**\
  \
  ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-9c38f9cadc7eb1a9099850ac199a2d38b9d8e493%2Fcomplexity-datasource-ds42-04.png?alt=media)<br>
* **Auto populate float question from datasource using samplesource variable**\
  \
  ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-1a8d6a310ae2890c7b47bfaea755272b0a984002%2Fcomplexity-datasource-ds42-05.png?alt=media)<br>
* **Auto populate float question with rows from datasource using samplesource variable**\
  \
  ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-468b38e734df7d2261a1da5b96c9d57ea2b4961c%2Fcomplexity-datasource-ds42-06.png?alt=media)<br>
* **Auto populate radio question with rows from datasource using samplesource variable**\
  \
  ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-2896881e044986618e22db32af8e35aaf68d4722%2Fcomplexity-datasource-ds42-07.png?alt=media)<br>
* **Auto populate radio question with columns from datasource using samplesource variable**\
  \
  ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-2c4426f0cb32b49521b6dd4fbd76bf915357d5a2%2Fcomplexity-datasource-ds42-08.png?alt=media)<br>
* **Auto populate radio question with rows and columns from datasource using samplesource variable**\
  \
  ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-01b3d22f780df8d080eecb210a2253d52329a4b4%2Fcomplexity-datasource-ds42-09.png?alt=media)<br>
* **Auto populate checkbox question from datasource using samplesource variable**\
  \
  ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-87793fdd00c1a5254575d10a83d4a7d7e37a2e28%2Fcomplexity-datasource-ds42-10.png?alt=media)<br>
* **Auto populate checkbox question with columns from datasource using samplesource variable**\
  \
  ![](https://1402057010-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgtHd8o9ldznZ1hKHiZvc%2Fuploads%2Fgit-blob-150338e6ebaf05844b6d16a25a509f96f4a53361%2Fcomplexity-datasource-ds42-11.png?alt=media)


---

# 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/datasource.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.
