Reset answers in matrix table | XM Community
Solved

Reset answers in matrix table

  • 18 December 2018
  • 9 replies
  • 45 views

Badge +3
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!
icon

Best answer by PeeyushBansal 18 December 2018, 15:23

View original

9 replies

Userlevel 7
Badge +33
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.
Badge +3
> @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.
Userlevel 7
Badge +33
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,
Badge +3
I only need calculated data which I save as unique emebeded data after each round - value_1, value_2 and so on.
Userlevel 7
Badge +33
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();
});`
Userlevel 7
Badge +33
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
}

});`
Badge +3
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.
Userlevel 7
Badge +33
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

}



});`
Badge +3
Thank you very much!

Leave a Reply