Constant sum "must total" validation option where the total must equal the response to previous question? | XM Community
Skip to main content

Hello all,
I am building a survey where I need a specific validation option that I am having trouble figuring out. 

In the survey, we will be asking two questions:
Q1. How many hours do you spend watching TV per week?

Q2. How are these hours spent watching TV per week distributed across the following TV Genres?

I have included a screenshot below as an example. 

I want the total for hours inputted into Q2 to be equal to the participants answer for Q1 (e.g. if the person says they watch 10 hours of TV per week in Q1, then the total of the hours across the genres must equal 10 hours in Q2).

I have no clue how to do this - be it with Javascript or Piped Text, so if someone could provide a detailed walk through of how this can be achieved, I would be very grateful - thank you. 
 

 

There is no need of JS, you can simply pipe in the value of previous question response under must total validation.

 


@ArunDubey That makes sense - thank you for your help. I have a follow up question - is it possible to add a validation to another constant sum question, but this time it needs to be equal to an individual answer in a previous constant sum q.

Eg. using your example screenshot, I add a new constant sum question, Q23, and I need the total of Q23 to be equal to Choice 1 in Q 22.

Hopefully that makes sense? 


Yes, you can apply must total based on specific answer option of constant sum question as well. Please make sure to test it before proceeding ahead.
 

 


@ArunDubey Thank you for your screenshots - please could you share what the full code is that I need to input into the “must total” box? I can only see half from the screenshot you shared (ie. ${q://QID22/ChoiceNumericEntry...)

 

 


Hi @st1518 , it was “${q://QID22/ChoiceNumericEntryValue/5}”. you can simply pipein value under question text and the cut and paste it under must total validation.


Leave a Reply