Increment embeded field data by 1 upon question display

BardzoGlupiLoginBardzoGlupiLogin Community Member Qubie ✭

Increment embeded field data by 1 upon question display

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

Best Answer

  • Pete_LPete_L Qubie ✭
    Accepted Answer

    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.

Answers

  • BardzoGlupiLoginBardzoGlupiLogin Community Member Qubie ✭
    edited October 2019

    ~~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.

  • BardzoGlupiLoginBardzoGlupiLogin Community Member Qubie ✭

    @Pete_L you are correct. And thank you for the code.
    It is more elegant then what I already did using survey flow only!

Sign In to Comment