# Check for all zeros

Dear All
How can I put a check on the following:

I have four questions Q3_1, Q3_2, Q3_3, Q3_4. I want to put a check where all questions cannot have zero entered.

I have put the following check on the last question (Q3_4) but it does not work

Q3_1 !=0 && Q3_2 !=0 &&Q3_3!=0 &&Q3_4 !=0

Hey,

I assume you mean using a validation when speaking of check? Therefore you want to have an error message if all questions are equal to 0?

Further, I assume you use Numeric Questions:

You could sum up all your questions and check that the sum is !=0 :

new[]{Q3_1,Q3_2,Q3_3,Q3_4}.Sum() !=0

You could use this as a validation check in Q3_4.

Otherwise use a static text which you only enable if new[]{Q3_1,Q3_2,Q3_3,Q3_4}.Sum() !=0 and add a validation check with condition1: false

Best
Peter

1 Like

Hello, Tshering

Good advice from Peter, but check if your questions have any negatives, e.g. -8 for â€śDonâ€™t knowâ€ť in that case you can get a zero sum even if none of answers is zero.

`new[] {Q3_1,Q3_2,Q3_3,Q3_4}.Count(q=>q==0)`
is counting the occurrence of zeros in the questions, but since this is a very frequent check, Survey Solutions already has a function for that - CountValue:
`CountValue(0, Q3_1,Q3_2,Q3_3,Q3_4)`
will count how many times the value zero occurs in the specified questions.

Be mindful of the unanswered questions. Do you want to treat unanswered questions as if they were zero? This may affect which of the functions to prefer as they differ in this respect.

Finally, you wrote â€śbut it does not workâ€ť, specifically what does it mean? If we know what message you are getting, can provide more specific explanation.

Best, Sergiy

2 Likes