ExpressionAnswerOptions
From LimeSurvey Manual
Hint: This features is available starting in version 5.3.0
Usage
Make answer option text available inside survey by expression function.
The function getAnswerOptionText get 3 parameters
- The question id or title
- The answer code to get
- The scale (for array dual scale question)
More detail
The function can be used with question id or question code. The result are not updated on same page.
Each parameters can use expression, the expression are checked before send to function.
The function use the result of the expression then, for question parameter: if it's a numeric value : start to check if the question id exist in this survey, and get the primary question if it's a sub question; if it's a string search the primary question title in this survey.
For the answer code : the result of the expression is used directly.
Before using these functions : the plugin must be activated in Plugin Manager.
Example
- Get the answer text of option A1 of current single choice question :
{getAnswerOptionText(self.qid,"A1")}
- Get the answer text of option A1 of array question with code 'Qcode' :
{getAnswerOptionText("Qcode","A1")}
- Get the answer text of same option choice done in a previous question with code prev of current single choice question :
{getAnswerOptionText(self.qid,prev.NAOK)}
(if 'prev' question are in same group, the answer was not updated).