Constant sum matrix with "must total" validation equal to one of 2 possible values? | XM Community
Skip to main content

Hi there,
I have several constant sum matrices on a page, but most of them are hidden unless the user reveals them. Not all of them will always be revealed. Right now, I have the validation set to the total must equal an embedded data field, but when some of the tables are not revealed, the user cannot advance in the survey because they still total zero.
Is it possible to have the constant sum must total validation equal to EITHER the embedded data field OR zero (i.e., the table is left blank)? I'm wondering if there is some kind of OR operator I can put in the box for Must total (see below), like "${e://Field/hrs_awake}||0"? I tried using || for OR, but that didn't seem to work.
image.pngThank you very much!

hilaryk
If the table is not revealed to the respondent the validation included is null and void as well. And it doesn't hamper the survey-taking experience. I believe there is some other issue that is hindering the experience here.
Hope it helps!


Hi Deepak,
I am not using Qualtrics's built-in display logic for the tables, because that won't let me show them all on the same page. Instead, I am using JavaScript to hide them all on the page load, and a button the user clicks to show them one at a time, up to the number that are required.
When I try to advance the survey after showing, say, three of the tables, the validation fails even when all the visible tables meet the criteria, the page reloads (thereby hiding all but the first table again), and when I click to reveal them, I see that the fourth table and all tables thereafter (which were not previously revealed) have the validation error above them.
With that info, do you have any ideas about how to get around this? Thanks very much.


hilaryk ,
Use custom validation with an 'Or'. However, there isn't a total to check, so you'll need a hidden text input question to store the total.


hilaryk
Yes, as mentioned correctly by TomG you can use custom validation with OR logic but for total value pipe the value and hide the question text and add validation on it, you can use the below code.
Click to write the question text
Hope it helps!


Thanks TomG and Deepak, I was able to get this working with a custom validation using JavaScript and a hidden field as you suggested. Not sure that's exactly what you were recommending, but it's working and you pointed me in a useful direction! Thank you both very much :)


Thank you guys for teaming yet another question! You two are amazing 🤩 TomG Deepak


Leave a Reply