Array Numbers with Sum Validation

More
3 years 9 months ago #104368 by chinaski01
chinaski01 created the topic: Array Numbers with Sum Validation
I want to do a Multiple Numeric Input question but as an array, like the Array Numbers question type, but where each column of answers sums to 100, as I can do with the Multiple Numeric Input. Is this possible?

To see what I mean, here is what it would look like



The "now" and "future" columns should sum to 100, no individual answer should be greater than 100 or less than 0.

Is this possible?
Attachments:

Please Log in to join the conversation.

More
3 years 9 months ago #104374 by TMSWhite
TMSWhite replied the topic: Array Numbers with Sum Validation
Yes, you can do this easily.

Here is what it looks like running:



Here is the question design view:



For the help text, you enter the following:
Total Now = {sum(self.sq_now)}
Total Future = {sum(self.sq_future)}

and this expands internally to look like this:



Here is the actual question as a .lsq file

File Attachment:

File Name: limesurvey..._192.lsq
File Size:5 KB


The Expression Manager documentation explains how to use the self variable in more detail.
Attachments:

Please Log in to join the conversation.

More
3 years 9 months ago #104392 by TMSWhite
TMSWhite replied the topic: Array Numbers with Sum Validation
I neglected the requirement that that each value be between 0 and 100.

Here is the corrected question as .lsq file:

File Attachment:

File Name: limesurvey...8318.lsq
File Size:5 KB



And the associated screenshot showing that it works:



The rest is the same.
Attachments:
The following user(s) said Thank You: chinaski01

Please Log in to join the conversation.

More
3 years 8 months ago #105681 by chinaski01
chinaski01 replied the topic: Array Numbers with Sum Validation
Thanks for your replies to this and sorry for my late response. I didn't receive a notification that someone had responded to this thread.

I have tested out your question example and it does work very well.

Cheers.

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!