Sum & validation in multiple numerical input question

More
3 weeks 5 days ago #173247 by vzyldd
vzyldd created the topic: Sum & validation in multiple numerical input question
Hi, need a little guidance please.

I'm using a multiple numerical input question but needs to validate the totals of the different sub-questions individually.

I need to check that the answer in sub-question 1 equals the sum of sub-question 2 and 3. Check that sub-question 4 is not more than the answer in sub-question 1.

I tried the validation in the sub-question validation box but somewhere I'm missing the target. I've used the following:
sum(Q2_4)=<sum(Q2_1) but are not sure if I am on the right track.
Attachments:

Please Log in or Create an account to join the conversation.

More
3 weeks 5 days ago #173255 by tpartner
tpartner replied the topic: Sum & validation in multiple numerical input question
I would think the question validation equation would be something like:

{Q2_1 == sum(Q2_2, Q2_3) && Q2_4 <= Q2_1}

Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: vzyldd

Please Log in or Create an account to join the conversation.

More
3 weeks 5 days ago - 3 weeks 5 days ago #173257 by Joffm
Joffm replied the topic: Sum & validation in multiple numerical input question
Hi,
yes, you are.

sum(Q2_4)=<sum(Q2_1)

But why do you "sum"? This are single fields.

So it is something like:
(Q2_1==sum(Q2_2,Q2_3) AND (Q2_1>=Q2_4)

And the tip could be:
{if(Q2_1!=sum(Q2_2,Q2_3),"Sum not equal Total","")}
...

But you have to add something that allows empty fields. Otherwise you will see the red border if "Total" is filled, but "boys" and "girls" still empty. Of course the sum is not equal in this case.






Best regards
Joffm


Volunteers are not paid.
Not because they are worthless, but because they are priceless
Attachments:
Last Edit: 3 weeks 5 days ago by Joffm.
The following user(s) said Thank You: vzyldd

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!