Welcome to the LimeSurvey Community Forum

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

Validating an Array (Texts)

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
10 years 2 months ago #103004 by DenisChenu
Replied by DenisChenu on topic Validating an Array (Texts)
I think :
sum(self) sum up all relevant option.

If you use array_filter it can work ?

No ?

Denis

PS: maybe it's better to do a new topic, and better explain. Because since one year there are a lot of change.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
10 years 2 months ago #103015 by tpartner
Replied by tpartner on topic Validating an Array (Texts)
Dede1989, what question types are you using?

Can you attach a small sample survey?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
More
10 years 2 months ago #103022 by Dede1989
Replied by Dede1989 on topic Validating an Array (Texts)
For my first question i'm using a multiple choice array. My second question, which uses the filter, is an array (numbers). My question validation for question 2 is "sum(self)==100". Maybe I can set all invisible options to a default value '0' ?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
10 years 2 months ago #103025 by tpartner
Replied by tpartner on topic Validating an Array (Texts)
Can you attach a small sample survey?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • TMSWhite
  • TMSWhite's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
10 years 2 months ago - 10 years 2 months ago #103068 by TMSWhite
Replied by TMSWhite on topic Validating an Array (Texts)
A working example is attached.

File Attachment:

File Name: limesurvey...1239.lss
File Size:25 KB


In this case, you use:
Code:
sum(self.sq_A.NAOK)

The reason this works is that sum(x,y,z) will only sum the visible values if you use the .NAOK suffix on each of x, y, and z (which is what self.sq_A.NAOK does). Without the .NAOK suffix, the sum will always be zero if any rows are invisible.

Here is a screen-shot:

Last edit: 10 years 2 months ago by TMSWhite.
The following user(s) said Thank You: DenisChenu, Dede1989
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose