Increment embeded field data by 1 upon question display | XM Community
Solved

Increment embeded field data by 1 upon question display

  • 25 October 2019
  • 3 replies
  • 328 views

Hello,

I'm wandering how can I increment by 1 a numeric embedded data filed when a given questions is displayed?

In my survey I'm using attention checks for some of the questionnaires. These are simple tasks - like "please choose 4 as your answer".
If a particiapnt fails to pick the write answer I will diplay him a warning (text type question) asking him to be more attentive.
What I would like to do, is to keep a live track on how many times a warning was shown so that I can eventually set a end-of-survey if those warinings where shown for example 3 times.

Is there an easy way to do it, for someone not fluent in JS?

Thank you
icon

Best answer by Pete_L 25 October 2019, 16:45

View original

3 replies

~~~~I think I solved it by scoring attention check questions, adding embedded data field to Score, and setting end of survey branch upon that.~~

If there is any easier solution I'm happy to use it:) ~~

It looks like I can't set the embedded filed to a Scoring value. At least this solution won't work:

!

Any help would be appreciated.
Userlevel 3
Badge +9
I want to be sure I understand what's happening.

Q1 - Respondent picks wrong answer and clicks submit/next
Q1_WARNING - Displays if respondent clicked wrong answer at Q1. Click next to go to Q2
Q2 - Respondent picks wrong answer and clicks submit/next
Q2_WARNING - Displays if respondent clicked wrong answer at Q2. Click next to go to Q3
Etc...

Is this correct?

If respondents are not able to back up, then you could do onPageSubmit to increment the embedded data on the warning page itself. Something like this on the warning pages:

Qualtrics.SurveyEngine.addOnPageSubmit(function()
{
var warns = "${e://Field/warns}";
var plusone = warns+1;
Qualtrics.SurveyEngine.setEmbeddedData("warns", plusone);

});

This will increment your embedded data by +1 whenever they click NEXT on those warning screens. If you're letting people back up then I suggest adding scoring your questions as right/wrong, adding it up at the end, and then displaying what you need to do at that point.
@Pete_L you are correct. And thank you for the code.
It is more elegant then what I already did using survey flow only!

!

Leave a Reply