Javascript for 2 constant sums in each row? | XM Community
Question

Javascript for 2 constant sums in each row?

  • 26 April 2020
  • 4 replies
  • 24 views

Hi all,
I am trying to create a survey that asks people to put in their name for each row and fill out numbers in the columns. I created a matrix table with constant sum but I would like to have 2 constant sums in each row for two different totals (see pic below). It seems like there is no default option on Qualtrics and the only way is to add a javascript, which I am not familiar with. I searched but couldn't find this question asked/answered before. I was wondering if there is any code for this. Thank you so much in advance!
Qualtrics Help.png


4 replies

Userlevel 7
Badge +22

Yes, we can do this with JS.
The other option could be, split the question into two separate separate matrix constant sum question with page break in between. Keep Q1 as it is but in Q2 carry forward choices on "Q1 - All choices entered text".

Thank you for your suggestions! I have never done JS so I would appreciate any pointers in terms of codes involved. Thank you again!

Userlevel 7
Badge +22

For JS, you need to change the question type to Matrix text entry question with 6 scale points/columns (A, B, (A+B), C, D, (C+D)). Make column 3 and column 6 read only. On blur event of any text box calculate the sum of each row and write it in respective row's column 3 and 6.

Thanks a lot! I will see how to write it up!

Leave a Reply