Welcome to the LimeSurvey Community Forum

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

Determine which subquestion was answered

  • baxterdmutt
  • baxterdmutt's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
5 months 1 day ago #252644 by baxterdmutt
Determine which subquestion was answered was created by baxterdmutt
Please help us help you and fill where relevant:
Your LimeSurvey version: 6.3.4
Own server
Survey theme/template: Fruity
==================
Is there a way to tell which subquestion in a List (with comments) was selected.  I know I can test for the answer, but the answer is long, so I thought if I could just tell which of G1Q02_AO01 or G1Q02_AO02 was the chosen answer.?
Thanks

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 months 1 day ago #252645 by Joffm
Replied by Joffm on topic Determine which subquestion was answered
Sorry,
this is very confusing.
Which question type are you really using?

"subquestion" -> multiple question
"list (with comments) -> single question
"AO01" -> single question
"G01Q02_AO01" -> multiple question, but with a strange subquestion code.

In a single question you get the selected answer code with {Q1}.

And multiple question? There may be more than one selected subquestion.
You may use the "list()" function which will return a comma separated list.
Have a look at the manual ("implemented functions")

Joffm 
​​​​​​
 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • baxterdmutt
  • baxterdmutt's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
5 months 11 hours ago #252648 by baxterdmutt
Replied by baxterdmutt on topic Determine which subquestion was answered
I must have worded my question poorly. I’ll try again.
It is a
"list (with comments) -> single question“
and I think that because I wrote it as "question_subquestion" I confused you . It is Question G2G00001 subquestions AO01 and AO02. (These are codes generated by Limesurvey so shouldn't be strange).
I can use an "if" to determine the answer chosen but because the answer in subquestion AO01 is very long I was wondering if instead of testing with if (G1Q0002==“This very very long answer that goes on for a couple sentences”,”True”,False”) can I instead just check if either subquestion AO01 or AO02 was selected as the answer. I looked in the manual but I couldn’t see this scenario, so maybe it's not possible. Thanks

Please Log in to join the conversation.

  • baxterdmutt
  • baxterdmutt's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
5 months 9 hours ago #252649 by baxterdmutt
Replied by baxterdmutt on topic Determine which subquestion was answered
I got it to work.
I'm sorry if I wasted everyones time.
{if(G1Q00001.NAOK=="AO02","Passed","Not passed")}
works.
The issue is that I trusted Limesurvey when it showed the G1Q00001.NAOK with a read box around it and when I ran the survey logic file check, it shows that "if" statement is an error at G1Q00001.NAOK, but when I run the survey, it works just fine.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 months 9 hours ago #252650 by Joffm
Replied by Joffm on topic Determine which subquestion was answered

I confused you . It is Question G2G00001 subquestions AO01 and AO02. (These are codes generated by Limesurvey so shouldn't be strange).

The strangeness is:
AO01 and AO02 are not subquestio ns. They are answer options.

The standard subquestion codes generated by LimeSurvey are SQ001, SQ002,. or SQ1, SQ2 (depends on version)
This - G01Q02_AO01 - is the QCode of a multiple question or an array question. "Questioncode_Subquestioncode"
as you see here
[url] manual.limesurvey.org/ExpressionScript_-...code_variable_naming [/url]
The automatically generated code could be G01Q02_SQ001, G01Q02_SQ002

Therefore I said "strange" subqiestion codes.

And I never had thought of such a simple IF statement when I read your question.
Next time, please, add an example what you want to achieve, either by explaning the workflow clearly or sending a lss export of these relevant question(s).

Joffm 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 months 4 weeks ago #252661 by DenisChenu
Replied by DenisChenu on topic Determine which subquestion was answered

I got it to work.
I'm sorry if I wasted everyones time.
{if(G1Q00001.NAOK=="AO02","Passed","Not passed")}
works.
The issue is that I trusted Limesurvey when it showed the G1Q00001.NAOK with a read box around it and when I ran the survey logic file check, it shows that "if" statement is an error at G1Q00001.NAOK, but when I run the survey, it works just fine.
Even after click on Surey logic !

It's a big really big issue here : can you report it please ?

community.limesurvey.org/bug-tracker/

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose