Comparing the responses to two questions | XM Community
Skip to main content

I have a simple need - to compare the values entered in to two text entries questions (validation numbers 0-100, no decimals) to make sure that one is less than or equal to the other, ie Age >= AgeDiagnosis. I’ve tried setting Enbedded Data Variables (Age, AgeDiagnosis), but cannot use Enbedded Data in custom validation of these questions. Is there another another easy way of comparing the response to these two questions, and if not valis, prompting the user to re-enter the second age?

Thank you!

Hi @MirandaSC Make sure both these questions are on separate pages and then apply the below custom validation.

Q1 Age - Custom validation - “entered value matches regex ^(100|00-9]{1,2})$

 

Q2 AgeDiagnosis - Custom validation - “entered value matches regex ^(100|g0-9]{1,2})$ AND it is less than ${q://QID1/ChoiceTextEntryValue} 

Here QID1 is the age question.

NOTE: Replace the above pipe text value with your own age question ID.

 


Thank you very much for your help. It worked perfectly! Just need to figure out what “^(100|00-9]{1,2})$” means!


Leave a Reply