Willkommen, Gast
Benutzername: Passwort: Angemeldet bleiben:
  • Seite:
  • 1
  • 2

THEMA: Validating an Array (Texts)

Validating an Array (Texts) 6 Monate 3 Wochen her #103000

  • DenisChenu
  • DenisChenus Avatar
  • OFFLINE
  • Moderator Lime
  • Beiträge: 6205
  • Dank erhalten: 787
  • Karma: 238
Hi,

And sum(self)==100 ?

Denis
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Validating an Array (Texts) 6 Monate 3 Wochen her #103003

  • Dede1989
  • Dede1989s Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 7
  • Karma: 0
What do you mean by And? sum(self)==100 does not work because limesurvey sums up all options (including invisible ones).
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Validating an Array (Texts) 6 Monate 3 Wochen her #103004

  • DenisChenu
  • DenisChenus Avatar
  • OFFLINE
  • Moderator Lime
  • Beiträge: 6205
  • Dank erhalten: 787
  • Karma: 238
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.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Validating an Array (Texts) 6 Monate 3 Wochen her #103015

  • tpartner
  • tpartners Avatar
  • OFFLINE
  • LimeSurvey Team
  • Beiträge: 4054
  • Dank erhalten: 740
  • Karma: 341
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Validating an Array (Texts) 6 Monate 3 Wochen her #103022

  • Dede1989
  • Dede1989s Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 7
  • Karma: 0
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' ?
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Validating an Array (Texts) 6 Monate 3 Wochen her #103025

  • tpartner
  • tpartners Avatar
  • OFFLINE
  • LimeSurvey Team
  • Beiträge: 4054
  • Dank erhalten: 740
  • Karma: 341
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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Validating an Array (Texts) 6 Monate 2 Wochen her #103068

  • TMSWhite
  • TMSWhites Avatar
  • OFFLINE
  • LimeSurvey Team
  • Beiträge: 759
  • Dank erhalten: 82
  • Karma: 36
A working example is attached.

Dateianhang:

Dateiname: limesurvey_survey_791239.lss
Dateigröße: 25 KB


In this case, you use:
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:

testofsumself.NAOK.PNG
Letzte Änderung: 6 Monate 2 Wochen her von TMSWhite.
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Folgende Benutzer bedankten sich: DenisChenu, Dede1989
  • Seite:
  • 1
  • 2
Moderatoren: ITEd
Ladezeit der Seite: 0.208 Sekunden
Donation Image