Welcome to the LimeSurvey Community Forum

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

How to reference current question answer for validation

More
10 years 6 months ago #99730 by mikeg
Hi,

I'm using LimeSurvey 2.00+ and I'm trying to write a validation equation but would like to have the criteria reference the current question so that I can copy and modify it for other situations.

More specifically, for an "Array (Numbers)" question, I would like to use the criteria

(sum(peerEvalFoxes_y1_x1,peerEvalFoxes_y2_x1,peerEvalFoxes_y3_x1,peerEvalFoxes_y4_x1,peerEvalFoxes_y5_x1)==10)

repeatedly in other questions but would like to avoid having to go and change the "peerEvalFoxes" text for each question. Is there a simple way to reference the current question with some kind of variable such as $currentQuestion (i'm just making that term up) so I could use the same text repeatedly, e.g.

(sum($currentQuestion_y1_x1,$currentQuestion_y2_x1,$currentQuestion_y3_x1,$currentQuestion_y4_x1,$currentQuestion_y5_x1)==10)
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
10 years 6 months ago - 10 years 6 months ago #99755 by tpartner
Try:
Code:
(sum(self.sq_y1_x1,self.sq_y2_x1,self.sq_y3_x1,self.sq_y4_x1,self.sq_y5_x1)==10)

manual.limesurvey.org/Expression_Manager....27that.27_variables

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 10 years 6 months ago by tpartner.
The following user(s) said Thank You: mikeg
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose