Reset answers in matrix table | XM Community
Skip to main content
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!
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.
> @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.
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,
I only need calculated data which I save as unique emebeded data after each round - value_1, value_2 and so on.
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();

});`
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

}



});`
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.
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



}







});`
Thank you very much!

Leave a Reply