Piping numerical response to previous question into custom validation of text entry form? | XM Community
Skip to main content
I am working on a survey that will be used to report aggregate numerical data. To reduce basic addition errors, I'm hoping to set up the survey so that respondents are required to report data that equals the total number of eligible participants they are reporting data on. Is is possible to set up validation for a text entry form that requires the sum of the form fields to equal the previous answer of total number of eligible participants?



For example, early in the survey I have a text entry form with two fields: the first field asks for total #of participants and the second field requests # of participants that meet program eligibility requirements. Several other questions in the survey ask them to report the demographics of the eligible participants. Using gender as an example of this, the sum of totals for gender (number of males + females) should equal the # of eligible participants. If gender is a text entry form variable, can I set up validation to require the response to equal the total number of eligible program participants entered previously?



Thanks for any suggestions. Not seeing an easy way to pipe in a open-ended numerical response into custom validation.
Hi @elsaspring,



Requirement is not very much clear. It would be great if you can share an easy example.
What I would suggest is to use math operations to create a new embedded data field with the sum. Then, in your question you want to validate, use custom validation:

!



And there, use the syntax "${e://Field/"enter embedded data name here"} to fill out your custom validation.



!



I've not tested this personally to make sure it works, but it's something to try, at least!
> @JenCX said:

> What I would suggest is to use math operations to create a new embedded data field with the sum. Then, in your question you want to validate, use custom validation:

> !

>

> And there, use the syntax "${e://Field/"enter embedded data name here"} to fill out your custom validation.

>

> !

>

> I've not tested this personally to make sure it works, but it's something to try, at least!



Thanks @JenCX, I tried this but it didn't seem to work. I spent a while trying to understand why I think this is why: on the validation support page, it says "You cannot set custom validation based off of embedded data, GeoIP, or any other fields." I'm pretty sure this is why this method hasn't worked for me.



Are there any other ways to use question validation to make sure that the answer to one sub-question is equal to the sum of other sub-questions in the same question? Thanks!

Any luck with this? I need to so something similar


I need something similar too.
I need the content validation on a Numeric Entry question to be based on the Numeric Entry response for the previous question.
e.g. For the below numeric entry questions -

  1. How many phones are present?

  2. How many sales did you make?

Require a content validation on 2. for the response to be less than equal to the response in 1.

Thoughts?


elsaspring for your text entry where you are having them tell you how many people are eligible, make sure you are validating that they enter a numeric value:
image.pngThen, as pictured above, instead of making the program sum boxes across questions/form fields - set these up as a constant sum question type. Then you can set the validation for Must Total and copy and paste the piped code for where you had your respondent enter number of eligible people.
image.png


https://www.qualtrics.com/community/discussion/comment/29416#Comment_29416piyush set up your question as a form. Make sure that the input values are set to validate to numerical.
image.pngThen set up content validation so that it checks your Sales Made is Less Than or Equal to VALUE 1. You will have to pipe in the value elsewhere and cut and paste the code into the validation box. If you have trouble getting it to set, make sure that an error message is chosen.
image.png


Leave a Reply