Quotas in scripting
Use scripting to get information about an existing quota.
Note:
- Scripting cannot increment quotas.
- The author must ensure that quota names are unique. If more than one quota shares the same name, only the first object is returned.
- The author must also ensure that quota names are literal values and that they are correct throughout the code snippet. If the values do not match, an error will occur.
- The script can return test quota counts (when using survey preview or a test activity link to complete the survey) or live quota counts (when using a live activity link).
Function or property | Description |
---|---|
const qt1 =
response.getQuota('seniorMaleRespondents');
|
Get a quota by name. |
qt1.count;
|
The number of responses that met the quota. Read-only. |
qt1.target;
|
The overall number of responses that the quota is supposed to collect. Read-only. |
qt1.isFull
|
Whether the quota count is more than or equal to the target. Read-only. |
Use cases
-
Concept testing, least filled, and even distribution
For example, let's say you have 3 images for respondents to evaluate and you want respondents to only see one image. You can use scripting to get the quotas' count information, determine instantly which of the 3 images has the fewest number of responses (is the least filled), and display that image to subsequent respondents.