Custom validation in constant sum question. | XM Community

Custom validation in constant sum question.

  • 27 January 2023
  • 3 replies
  • 60 views

Userlevel 4
Badge +12

Hi All,
I have a constant sum question. I want to add a validation here that SUM OF A,B and C MUST BE AT LEAST 50% IN COMBINATION, ELSE TERMINATE. Can we do this with JS?
image.png


3 replies

Userlevel 5
Badge +12

Hi dipeshsingh
This thread might help. Please have a look.
PS: The above attached case is very similar to yours, you might do some changes in the provided custom code and you'll get the solution.

Userlevel 7
Badge +27

dipeshsingh,
If the question is the last in the block, then you can perform the calculation and terminate logic in the survey flow (replace QIDxx with actual question id):
Set Embedded Data:
ABDsum = $e{ q://QIDxx/ChoiceNumericEntryValue/1 + q://QIDxx/ChoiceNumericEntryValue/2 + q://QIDxx/ChoiceNumericEntryValue/4 }

Branch:
If Embedded Data ABDsum Is Less Than 50

End of Survey

Userlevel 4
Badge +12

Hi TomG

My question was not in the end of block by I did a similar thing. I created a additional text entry question to validate and terminate. BTW thanks :)
image.png

Leave a Reply