Welcome, Guest
Username: Password: Remember me

TOPIC: How to reference current question answer for validation

How to reference current question answer for validation 10 months 1 week ago #99730

  • mikeg
  • mikeg's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 10
  • Karma: 0
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 administrator has disabled public write access.

How to reference current question answer for validation 10 months 1 week ago #99755

  • tpartner
  • tpartner's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 4050
  • Thank you received: 740
  • Karma: 341
Try:
(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.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
Last Edit: 10 months 1 week ago by tpartner.
The administrator has disabled public write access.
The following user(s) said Thank You: mikeg
Moderators: ITEd
Time to create page: 0.145 seconds
Donation Image