adding autoincrementing respondent counter to survey | XM Community
Skip to main content
Question

adding autoincrementing respondent counter to survey

  • December 2, 2025
  • 4 replies
  • 40 views

Forum|alt.badge.img+1

This seems trivial but can’t figure it out. I would like to include a simple “respondent counter” variable in a survey, with the counter autoincrementing with each (completed) response. That is, the data table of responses should contain a simple integer field showing “1” for the first repondent, “2” for the second and so on.

I’ve looked into various possible solutions, such as:

  • setting embedded data in the survey flow (no counter options)
  • post-survey options (no counter options)
  • quota functionality (“quota count” comes close, but is a single auto-updated number, not a field within each survey response)

Importantly, I need this counter variable already present in the survey reponse/data table in order to add it to a contact list (and have it available for downstream surveys). So offline creation of the counter (e.g., based on response datetime) is not an option. Any suggestions welcome.

4 replies

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • December 2, 2025

I think the best way is to use a survey flow web service call to keep and update an external count and return the counter as an embedded data field.

Another approach would be to use a quota and the piped quota count to calculate the counter (e.g., counter = $e{ qo://QO_xxx/QuotaCount + 1 }). However, with this approach you might end up with some duplicate and missing counts due to simultaneous responses (e.g., 1, 2, 3, 3, 5, 6, etc.).


Forum|alt.badge.img+1

Another approach would be to use a quota and the piped quota count to calculate the counter (e.g., counter = $e{ qo://QO_xxx/QuotaCount + 1 }). However, with this approach you might end up with some duplicate and missing counts due to simultaneous responses (e.g., 1, 2, 3, 3, 5, 6, etc.).

Thanks Tom, I’ve been testing this solution and it’s very promising. I set up a quota that increases whenever its own value is equal or greater than zero, so essentially “count always”. Then, in the survey flow I add the quota counter from the piped text menu “${qo://QO_xxxx/QuotaCount}”. This counter increases with each response, but starting, as expected, at 0.

Minor, but I can’t get the “+1” right. When doing “${qo://QO_xxxx/QuotaCount + 1}” the field remains empty, so looks like the +1 isn’t parsed. Also tried “${qo://QO_xxxx/QuotaCount } + 1” but then I get a literal value like “9 + 1”. Guessing some variable type conversion (string/numerical) is needed. Suggestions on how to do this?

And related/more generally, is it possible to do things like concatenating piped variables with fixed text (or each other), along the lines of [“myText” ${qo//…./someVar}] ? Can’t find any documentation on any “pseudocoding” functionality that may be available when handling piped variables.


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • December 8, 2025

To do + 1 use:

$e{ qo://QO_xxx/QuotaCount + 1 }

Note the e before the {.  The spaces between everything are required.  Also, you need to replace QO_xxx with the actual quota id.

Yes, you can concatenate embedded fields with text or each other - no quotes are necessary:

my text ${e://Field/variable1} ${e://Field/variable2}

 


Forum|alt.badge.img+22

Just curious, instead of the +1, wouldn’t setting the quota value to start from 1 in the quota setting be fine?

Or is there any reason this method is not recommended?