Custom Validation for Matrix Constant Sum | XM Community
Solved

Custom Validation for Matrix Constant Sum

  • 24 October 2023
  • 5 replies
  • 88 views

Userlevel 2
Badge +3

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

icon

Best answer by TomG 24 October 2023, 16:36

View original

5 replies

Userlevel 7
Badge +20

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?

Leave a Reply