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

Custom Validation for Matrix Constant Sum

  • 24 October 2023
  • 6 replies
  • 151 views

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

6 replies

Userlevel 7
Badge +22

Hi @Carolinedavies 

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

 

Userlevel 2
Badge +3

@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.  

Userlevel 7
Badge +27

@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

Userlevel 2
Badge +3

@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! 

Badge +1

Hey @Carolinedavies ,

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

Badge +2

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