Create a counter based off answer | XM Community
Skip to main content

Hello, for certain questions in my survey, I want to increment a counter by 1.  The counter should be incremented if code is either -3 or -4 (Which are for ‘UNCLEAR RESPONSE’  and ‘USE ALTERNATE SCALE FOR THIS QUESTION’).  I have tried a few ways to do this in Javascript but can’t figure this out . My other option is to increment after each of the questions, but I wanted to avoid breaking my questions up into so many blocks in survey flow.

 

This can be easily accomplished via scoring or through Math operations in ED.

Refer to the support pages.


This is great, scoring worked perfectly. Thank you!


Actually, I need to now use the score for display logic. I created an embedded data field, Counter that is equal to the score: ${gr://SC_d4riZkQXINedJnU/Score}. When I try to use Counter for display logic (i.e. if Counter is greater than 3, then display) it does not work


Can you share a screenshot of how you are creating the ED.


yes, thank you!

 


This should work. Try piping the Counter ED at someplace to see what it’s value is.


No, I must be missing something?  I even tried changing ED to a number. i piped both the score and also my ED ‘Counter’

 


I think I see what’s going on.  doing this does not make my ED ‘Counter’ dynamic  - it will not update as score increases.  I have to call in/create it in Survey flow after the questions.  However, I need something that will check after each question, not wanting to create a block in survey flow for each check. But I’m not sure this is possible? 

 

If this is the case perhaps its simpler to just create a counter = counter +1 in ED and get rid of scoring.  I will have to break my questions but between blocks…?


Leave a Reply