# Quotas

Metaforms supports a wide range of Quotas in your surveys.

Let's take a look at all of them:<br>

* **Dynamic priority for quota controlled using quota hook function as shown in the below example.**

  * **Q1**. How likely are you to use these streaming services in the next 6 months?<br>

    | Service      | Extremely likely | Likely      | Somewhat likely | Not likely  | Not at all likely   |
    | ------------ | ---------------- | ----------- | --------------- | ----------- | ------------------- |
    | Netflix      | <p><br></p>      | <p><br></p> | <p><br></p>     | <p><br></p> | <p><br></p>         |
    | Amazon Prime | <p><br></p>      | <p><br></p> | <p><br></p>     | <p><br></p> | <p><br></p>         |
    | Disney+      | <p><br></p>      | <p><br></p> | <p><br></p>     | <p><br></p> | <p><br></p>         |
    | Hulu         | <p><br></p>      | <p><br></p> | <p><br></p>     | <p><br></p> | <p><br></p>         |
    | HBO Max      | <p><br></p>      | <p><br></p> | <p><br></p>     | <p><br></p> | <p><br><br><br></p> |

  <br>

  * **Q2**. Which streaming service would you prefer most?\
    \
    1\. Netflix 2. Amazon Prime 3. Disney+ 4. Hulu 5. HBO Max<br>
  * \[Programming Notes]

    Auto-punch Q2 based on Q1 responses with following priority:

    * First, select row with "Extremely likely" (column 1)
    * If no "Extremely likely", select row with "Likely" (column 2)
    * If no "Likely", select row with "Somewhat likely" (column 3)
    * If multiple rows have same rating, select first occurrence

    If all rows are rated "Not likely" or "Not at all likely", no auto-punch<br>
* **Simple quotas and cross quotas are mentioned in the QNR in tabular format as given in the example below and each quota is added in a separate sheet in a quota sheet.**<br>

  | UK | 200 |
  | -- | --- |
  | US | 200 |
  | DE | 200 |

  <br>

  | Male   | 50% |
  | ------ | --- |
  | Female | 50% |

  <br>

  | 1-17  | 85 |
  | ----- | -- |
  | 18-24 | 85 |
  | 25-34 | 85 |
  | 35-44 | 85 |
  | 45-54 | 85 |
  | 55-64 | 85 |
  | 65+   | 90 |
* Simple quotas and cross quotas are mentioned in the QNR in list format as given in the example below and each quota is added in a separate sheet in the quota sheet.\
  \
  \[SCREENER SECTION]\
  \
  \[QUOTA SETUP]
  * Individual Quotas:\
    \- Country (200 each)\
    \- Gender (300 each)\
    \- Age Ranges (85-90 each)
  * Country x Gender Quotas:\
    \- US Male: 100\
    \- US Female: 100\
    \- UK Male: 100\
    \- UK Female: 100\
    \- DE Male: 100\
    \- DE Female: 100
  * Gender x Age Range:\
    \- Male x Each Age Range: \~42-45\
    \- Female x Each Age Range: \~42-45
  * Country x Age Range:\
    \- Each Country x Each Age Range: 30
  * **Q Country:** In which country do you currently reside? (Select one)\
    1\. United States (US)\
    2\. United Kingdom (UK)\
    3\. Germany (DE)\
    \
    **Programmer Note for QCountry:**\
    \- Set up country quota: US=200, UK=200, DE=200.\
    \- Terminate if country quota is full.<br>
  * **Q Gender:** What is your gender? (Select one)\
    1\. Male\
    2\. Female

    \
    **Programmer Note for QGender:**\
    \- Set up gender quota: Male=300, Female=300\
    \- Terminate if gender quota is full<br>
  * **Q Age:** What is your age?\
    (Please enter your age in years)\
    \[Numeric text box]\
    \
    **Programmer Note for QAge:**\
    \- Accept only numeric values\
    \- Minimum value: 1\
    \- Maximum value: 99\
    \- Show error message: "Please enter a valid age between 1-99"\
    \- Calculate and populate QHiddenAge based on entered value\
    \- Terminate if age range quota is full\
    \
    \&#xNAN;**\[Hidden]**
  * **Q HiddenAge**: Age Range\
    1\. 1-17\
    2\. 18-24\
    3\. 25-34\
    4\. 35-44\
    5\. 45-54\
    6\. 55-64\
    7\. 65+

    \
    **Programmer Note for QHiddenAge:**\
    \- Auto-populate based on QAge response\
    \- Set up age range quotas:\
    \* 1-17: 85\
    \* 18-24: 85\
    \* 25-34: 85\
    \* 35-44: 85\
    \* 45-54: 85\
    \* 55-64: 85\
    \* 65+: 90<br>
* **Single punch least fill as given in the below example.**
  * **Q1**. Which reading devices do you currently use? (Select all that apply)\
    1\. E-reader\
    2\. Tablet\
    3\. Smartphone\
    4\. Laptop/Computer
  * Q1LeastFilled. \[Auto-select one device based on least-fill quota]\
    \
    **Quota Note:**
  * Target: 150 completes per option.
  * System should automatically route respondents to the option with lowest current count.
  * Example: If current counts are:\
    \* E-reader: 100\
    \* Tablet: 50\
    \* Smartphone: 75\
    \* Laptop/Computer: 80
  * Next respondent will be routed to Tablet.
  * For respondents who select multiple devices, system should assign them to the device category with lowest count.<br>
* **Multi punch least fill as given in the below example**
  * **Q2a**. Which of these book genres have you read in the past 3 months? (Select all that apply)

    1\. Mystery

    2\. Romance

    3\. Science Fiction

    4\. Fantasy

    5\. Biography

    6\. Self-Help\
    \
    Q2aLeastFilled. \[Program to automatically select 2 least-filled genres from Q2a]

    \
    **Quota Note:**
  * Need 100 completes for each genre
  * System should select 2 genres per respondent based on least-filled quotas
  * Example: If current counts are:
    * Mystery: 80
    * Romance: 40
    * Science Fiction: 60
    * Fantasy: 30
    * Biography: 70
    * Self-Help: 50
  * System will select Fantasy and Romance for next respondent
  * Continue until all genres reach target.<br>
* **Cross quota with least fill as given in the below example.**
  * **Q3a**. Which of the following book formats do you use? (Select all that apply)\
    1\. Physical Books\
    2\. E-books\
    3\. Audiobooks
  * **Q3b**. Which of the following book genres do you read? (Select all that apply)\
    1\. Mystery/Thriller\
    2\. Romance\
    3\. Science Fiction\
    \
    \&#xNAN;**\[Hidden Question]**\
    Q3LeastFilled.\
    \[Auto-select one format x genre combination based on least-fill quota]

    \
    **Cross Quota Note:**
  * Total sample: 300.
  * Need balanced distribution across all combinations.
  * 9 cells (3x3 matrix).
  * Target \~33 completes per cell.
  * System should route to least-filled combination.
  * **Example**: If current counts are:
    * Physical Books x Mystery: 20
    * Physical Books x Romance: 15
    * Physical Books x SciFi: 10
    * E-books x Mystery: 25
    * E-books x Romance: 5
    * E-books x SciFi: 30
    * Audiobooks x Mystery: 15
    * Audiobooks x Romance: 20
    * Audiobooks x SciFi: 25
  * Next respondent will be routed to "E-books x Romance" combination.
  * Continue until all cells reach target.
* **Quota with question referred in many cross quotas and have to maintain the count among the quotas, using plus in defines and doit="1" in quota tag**<br>
  * **Q Gender**. What is your gender? (Select one)\
    1\. Male\
    2\. Female
  * **Q Age**. What is your age?\
    (Please enter your age in years)\
    \
    \&#xNAN;**\[Hidden]**
  * **QAgeRange**. Age Range\
    1\. 18-24\
    2\. 25-34\
    3\. 35-44\
    4\. 45-54\
    5\. 55+
  * **Q5a**. Which of these book publishers do you know? (Select all that apply)\
    1\. Penguin Random House\
    2\. HarperCollins\
    3\. Simon & Schuster\
    4\. Macmillan\
    5\. Hachette\
    \
    **Cross Quota Note:**
  * 1\. Publisher x Age Quota:\
    \- Each Publisher x Age Group combination needs 30 completes
  * Publisher x Gender Quota:\
    \- Each Publisher x Gender combination needs 40 completes\
    \
    \&#xNAN;**\[Hidden Question]**
  * Q5LeastFilled. \[Single select]\
    1\. Penguin Random House\
    2\. HarperCollins\
    3\. Simon & Schuster\
    4\. Macmillan\
    5\. Hachette

    \
    **Programming Notes:**
  * Single hidden question for least-filled publisher assignment.
  * Consider both quota matrices when selecting publisher.
  * Update both quotas simultaneously.
  * Terminate when quotas are full.<br>
* **Quotas with static priority as given in the below example**<br>
  * **Q6a**. Which of these book genres have you read in the past year? (Select all that apply)\
    1\. Mystery/Thriller\
    2\. Romance\
    3\. Science Fiction\
    4\. Fantasy\
    5\. Biography\
    6\. Self-Help
  * **Q6b**. How likely are you to recommend **\[PIPE-IN GENRE]** books to others? \[Show genre based on priority and least-fill]\
    1\. Very likely\
    2\. Somewhat likely\
    3\. Not very likely\
    \
    **Priority and Quota Note:**
  * Priority Order: Mystery/Thriller, Romance.
  * If Mystery/Thriller (code 1) is selected in Q6a, pipe it into Q6b.
  * If Mystery/Thriller not selected but Romance (code 2) is selected, pipe Romance.
  * If neither priority genre is selected, pipe the least-filled genre from respondent's other selections.
  * Target: 100 completes per genre.<br>
* **Quota with different priority for logic for different conditions e.g., for male give priority to some brands and for female give priority for some other brands as shown in the below example.**<br>

  * **QGender**. What is your gender? (Select one)

    1\. Male

    2\. Female
  * **Q28a**. Which of these publishers have you heard of? (Select all that apply)

    1\. Penguin Random House

    2\. HarperCollins

    3\. Simon & Schuster

    4\. Macmillan

    5\. Hachette

    6\. Bloomsbury

    \
    **Hidden Question - System Generated**

    Q28select. \[Auto-select one publisher based on gender-specific priority and leastfill]\
    \
    **Priority Logic:**
  * If Male:

    1\. First try to assign Penguin Random House.

    2\. If quota full, try HarperCollins.

    3\. If quota full, try Simon & Schuster.

    4\. If all priority quotas full or not selected, assign least-filled among remaining publishers.
  * If Female:

    1\. First try to assign Bloomsbury.

    2\. If quota full, try Macmillan.\
    3\. If quota full, try Hachette.\
    4\. If all priority quotas full or not selected, assign least-filled among remaining publishers.\
    \
    **Quota targets:**
  * Male respondents:

    \- Penguin Random House: 100

    \- HarperCollins: 75

    \- Simon & Schuster: 75

    \- Others: 50 each
  * Female respondents:

    \- Bloomsbury: 100

    \- Macmillan: 75

    \- Hachette: 75

    \- Others: 50 each\
    \
    **Programming Note:**
  * Apply priority logic based on gender.
  * Only consider publishers selected in Q28a.
  * **Q28b**. How familiar are you with \[PIPE: SELECTED PUBLISHER]? (Select one)

    1\. Very familiar

    2\. Somewhat familiar

    3\. Not very familiar

    4\. Not at all familiar

    \
    \
    \
    \ <br>

  \ <br>

  \
  \ <br>

  \ <br>

\ <br>

<br>

\ <br>

\ <br>

\
\
\
\ <br>


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

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

The question should be specific, self-contained, and written in natural language.
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.
