Custom Validation for Matrix Constant Sum | XM Community
Skip to main content

Hello, 

 

I need validation so that the sum of the percentages is 100% or “Don’t Know” is selected. I don’t see an option for summing the percentages in custom validation, so I think I need custom JavaScript but I am not a coder! Could someone please assist? 

 

Thank you in advance! 

Caroline

Hi @Carolinedavies 

There’s must total option in the validation section. Hope this helps
 

 


@dxconnamnguyen Yes, I tried that (sorry I should have mentioned this is my original post), but the problem is if you select “Don’t Know” the total still must be 100.  


@Carolinedavies - You can sum the total with an math expression in your validation condition:

Category A = $e{ 100 - q://QIDx/ChoiceNumericEntryValue/2 - q://QIDx/ChoiceNumericEntryValue/3 - q://QIDx/ChoiceNumericEntryValue/4 - q://QIDx/ChoiceNumericEntryValue/5 }

OR

Don’t know is selected


@TomG Thank you so so much!! This really saved us. 

I used Category A = $e{100 - ${q://QID1/ChoiceNumericEntryValue/2/1} - ${q://QID1/ChoiceNumericEntryValue/3/1} - ${q://QID1/ChoiceNumericEntryValue/4/1} -  ${q://QID1/ChoiceNumericEntryValue/5/1}} 

 

It worked perfectly! Thanks Again! 


Hey @Carolinedavies ,

Can you tell me how you added the “Don’t know” button at the bottom?


I want to set constant sum with Don’t know(exclusive) option. Here brands are coming from previous selection. Please help to set up.. @TomG 

 

Example-
Q4 is a multiselect question, where i select option A,B,C
 

 

 

Then next question shows like 

 

Now, i want to select either “Don’t know” or input values for A,B,C. The input value for A,B,C must be 100.
How can i validate Q2, as number of options based on previous question Q4.


Leave a Reply