How to reference current question answer for validation

More
4 years 2 months ago #99730 by mikeg
mikeg created the topic: How to reference current question answer for validation
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)

Please Log in to join the conversation.

More
4 years 2 months ago - 4 years 2 months ago #99755 by tpartner
tpartner replied the topic: How to reference current question answer for validation
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.
Last Edit: 4 years 2 months ago by tpartner.
The following user(s) said Thank You: mikeg

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!