Welcome to the LimeSurvey Community Forum

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

Accessing the sub/question name with EM

  • orvil
  • orvil's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
8 years 7 months ago #124553 by orvil
Hi there,
may be I'm blind, but I could'not find a solution in the documentation:

I'd like to get the name (i.e. whats named 'code' in the BE) for further processing in an EM equation.

so eg. my question is named 'Quest01'
the subquestions are named 'SQ001', 'SQ002', ... , 'SQ012'

Id like to get the 'Quest01' as a string as well as the 'SQ001' ...

Unfortunately, Qcode.jsName, Qcode.sgqa are NOT a solution to me.

Any ideas??

THX in advance
Orvil

Best regards/Beste Grüße,
O. Villani
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 7 months ago #124559 by holch
Replied by holch on topic Accessing the sub/question name with EM
You are talking about the actual question text and the subquestion text, not the question code and the subquestion code, right? Because your Quest1 and SQ001 etc. look rather like question and subquestion/answer codes to me.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • orvil
  • orvil's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
8 years 7 months ago #124564 by orvil
Replied by orvil on topic Accessing the sub/question name with EM
Hi,

I've marked the names (=strings) I'd like to use in the picture

Best regards/Beste Grüße,
O. Villani
Attachments:
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 7 months ago #124565 by tpartner
Replied by tpartner on topic Accessing the sub/question name with EM
As far as I know, there is no Expression Manager variable that returns a question or sub-question code.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 7 months ago #124570 by holch
Replied by holch on topic Accessing the sub/question name with EM
But to access anything with EM you need to know the question code and the subquestion code. How do you want to tell Limesurvey which question code you want as a string without this proper question code?

And if you have the question code, you can just write it. To me it is not really clear what you actually want to do with this.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • orvil
  • orvil's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
8 years 7 months ago #124577 by orvil
Replied by orvil on topic Accessing the sub/question name with EM
Hi holch,

of course, it's not that usual what I have to do.

@But to access...: there are the reserved this. and self. variables to access the very question I'm working with. But this.code or self.code are not returning the code!

@what I want to do: I have to use an expression that is the same in each question / subquestion except one number (used as an index).
An example, my EM expression is:
{csv_get(eq01, 3)}
where
csv_get is a self-programmed EM function :) and returns an entry from a csv list like "this,is,really,great" ('really' in this example)
eq01 is an equation (question) within the survey containing "this,is,really,great"
and the index 3 is different from question to question, i.e. in Quest01 the index is 1, in Quest02 the index is 2, in Quest03 the index is 3.
Do you see my intention? I'd like to use (a part of) the question code as a tag. So my final intention is an EM expression like:
{csv_get(eq01, tagnum(this.code))}
where tagnum is a simple function I've wrote to extract the number from a string like "Quest01" i.e. 1
and this.code is the non-existing desired function to get the questions code (eg) "Quest01"!

So I have to reedit the EM formula every time, even if there is only a small change. And if you have to do this dozens of times its really a pitty.

Best regards/Beste Grüße,
O. Villani
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 7 months ago #124588 by holch
Replied by holch on topic Accessing the sub/question name with EM
Now I get it what you are trying to do. But sorry, I have no solution for this.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • orvil
  • orvil's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
8 years 7 months ago #124617 by orvil
Replied by orvil on topic Accessing the sub/question name with EM
Anyway, thanks for your effort,
maybe I have to patch or extend the self. variable. Any idea where this/self is implemented?

best regards

Best regards/Beste Grüße,
O. Villani
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose