Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

SUm and validate array column

  • brais24
  • brais24's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
2 years 11 months ago #216673 by brais24
SUm and validate array column was created by brais24
Hi People, I need to do something, I have 2 questions, a "P2" array text number, and a "P3" multiple numerical input.

The first column of P2 is to insert number of mans, and on P3 the number of mans should be the same of that column or less, and is not, show a message, i try to fo it putting this on ecuation validation question on P3

sum(self.sq_SQ001.NAOK)<=sum(that.P2.sq_SQ001.shown) AND sum(self.sq_SQ002.NAOK)<=sum(that.P2.sq_SQ002.shown)

And this on ecuation validation help on P3

{if(sum(self.sq_SQ001.NAOK)>sum(that.P2.sq_SQ001.shown),"O total de homes debe ser inferior ou igual " ,"")}

Looks like it works, but as you can see on the image, looks like only have in count the first digit, dont do the validation well

How can I do this please?

Thank you

File Attachment:

File Name: limesurvey...2893.lss
File Size:42 KB

File Attachment:

File Name: limesurvey...2893.lss
File Size:42 KB
Attachments:
The topic has been locked.
  • brais24
  • brais24's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
2 years 11 months ago #216674 by brais24
Replied by brais24 on topic SUm and validate array column
Here is the image

 
The topic has been locked.
  • brais24
  • brais24's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
2 years 11 months ago #216675 by brais24
Replied by brais24 on topic SUm and validate array column
My LS version is 2.72.3+171020
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
2 years 11 months ago #216690 by Joffm
Replied by Joffm on topic SUm and validate array column
Hi,
1. validation equation:
self.sq_SQ001.NAOK<=sum(that.P2.sq_SQ001.NAOK) AND self.sq_SQ002.NAOK<=sum(that.P2.sq_SQ002.NAOK)

2. validation tip (as you did it.)
{if(self.sq_SQ001.NAOK>sum(that.P2.sq_SQ001.NAOK),"O total de homes debe ser inferior ou igual " ,"")}<br/> {if(self.sq_SQ002.NAOK>sum(that.P2.sq_SQ002.NAOK),"O total de mulleres debe ser inferior ou igual ","")}

Joffm








Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose