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

Create a counter based off answer

  • February 12, 2024
  • 8 replies
  • 249 views

Forum|alt.badge.img+2

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.

 

Best answer by ahmedA

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

Refer to the support pages.

View original

8 replies

Forum|alt.badge.img+22
  • Level 7 ●●●●●●●
  • 2028 replies
  • Answer
  • February 12, 2024

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

Refer to the support pages.


Forum|alt.badge.img+2
  • Author
  • Level 2 ●●
  • 14 replies
  • February 12, 2024

This is great, scoring worked perfectly. Thank you!


Forum|alt.badge.img+2
  • Author
  • Level 2 ●●
  • 14 replies
  • February 12, 2024

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


Forum|alt.badge.img+22
  • Level 7 ●●●●●●●
  • 2028 replies
  • February 12, 2024

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


Forum|alt.badge.img+2
  • Author
  • Level 2 ●●
  • 14 replies
  • February 12, 2024

yes, thank you!

 


Forum|alt.badge.img+22
  • Level 7 ●●●●●●●
  • 2028 replies
  • February 12, 2024

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


Forum|alt.badge.img+2
  • Author
  • Level 2 ●●
  • 14 replies
  • February 12, 2024

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

 


Forum|alt.badge.img+2
  • Author
  • Level 2 ●●
  • 14 replies
  • February 12, 2024

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