Community Groups are officially here!
We've released Groups, a new feature that enables us to connect community members of similar industries and interests in a shared, private space. You can check out all of the details here, including information about who can join, how to join, and what Groups are currently offered. Please leave your feedback through this Community Groups Feedback Survey.

Reset answers in matrix table

michalkohuttn
michalkohuttn Community Member Qubie ✭

Hello,
I need to present matrix table where instructions as well as each questions (single-answer radio buttons) are based on variables previously set as embeded field. I want to repeat it many times. There are many if's and variations so I didn't choose loop&merge but made it in survey flow, which goes:
1. values are set (embeded data)
2. question X is presented with set values
3. question Y is presented with answers computed based on answers for question X
4. values are computed based on selected answers and saved as embeded data (I only need this)
5. repeat

What I didn't consider was that if I repeat the same questions X&Y, answers will be set from the first round. Is there a way to reset selected response in these questions? Thank you very much!

Best Answer

  • PeeyushBansal
    PeeyushBansal IndiaCommunity Member, XMPN Member, Qualtrics Brand Admin Wizard ✭✭✭✭✭
    edited December 2018 Accepted Answer

    Don't use arr2 instead use like

    `Qualtrics.SurveyEngine.addOnload(function()
    {

    var arr1=[1,2,3,4,5,6]; //rows

    for(var i=0;i<arr1.length;i++)
    {
    var x = arr1[i];
    var y = 1;
    var m=2;
    this.setChoiceValueByRecodeValue(x,y,false ); //to punch the answer in next matrix
    this.setChoiceValueByRecodeValue(x,m,false ); //to punch the answer in next matrix

    }

    });`

Answers

  • PeeyushBansal
    PeeyushBansal IndiaCommunity Member, XMPN Member, Qualtrics Brand Admin Wizard ✭✭✭✭✭

    Are you using the same question in survey flow for each branch.
    if yes it will set the previous selected value if question is presented again.

  • michalkohuttn
    michalkohuttn Community Member Qubie ✭

    @bansalpeeyush29 said:
    Are you using the same question in survey flow for each branch.
    if yes it will set the previous selected value if question is presented again.

    Yes I am. That's why I'm asking, if there is a way to reset it.

  • PeeyushBansal
    PeeyushBansal IndiaCommunity Member, XMPN Member, Qualtrics Brand Admin Wizard ✭✭✭✭✭

    No actually, You have to make multiple questions as many time you are running for.
    Even if you clear data for one iteration than your data will also be lost,

  • michalkohuttn
    michalkohuttn Community Member Qubie ✭

    I only need calculated data which I save as unique emebeded data after each round - value_1, value_2 and so on.

  • PeeyushBansal
    PeeyushBansal IndiaCommunity Member, XMPN Member, Qualtrics Brand Admin Wizard ✭✭✭✭✭

    Yeah you can set values to false like below:-

    `Qualtrics.SurveyEngine.addOnload(function()
    {
    /Place your JavaScript here to run when the page loads/

        {this.setChoiceValue(1,false) ; }
        {this.setChoiceValue(2,false) ; }
        var questionDiv = this.getQuestionContainer();
    

    });`

  • PeeyushBansal
    PeeyushBansal IndiaCommunity Member, XMPN Member, Qualtrics Brand Admin Wizard ✭✭✭✭✭

    since you have matrix question you can use like, arr1 (number of rows), arr2(no of columns)

    `Qualtrics.SurveyEngine.addOnload(function()
    {

    var arr1=[1,2,3]; //rows
    var arr2=[1,2,3]; //Columns

    for(var i=0;i<arr1.length;i++)
    {
    var x = arr1[i];
    var y = arr2[i];
    this.setChoiceValueByRecodeValue(x,y,false ); //to punch the answer in next matrix
    }

    });`

  • michalkohuttn
    michalkohuttn Community Member Qubie ✭

    Hi, thank you very much. It seems to be on a good way - I have 6 rows and 2 columns, so:

    var arr1=[1,2,3,4,5,6]; //rows
    var arr2=[1,2]; //Columns

    but it only resets the answer for the first 2 rows, not for others. As I'm total newbie, I can't help myself... thanks again.

  • michalkohuttn
    michalkohuttn Community Member Qubie ✭

    Thank you very much!