Welcome to the LimeSurvey Community Forum

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

Expression Manager summary with placeholders: how to only show specific answers

  • eleren
  • eleren's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 1 month ago #116441 by eleren
Case: array question with 5-step label from "don't agree at all" to "completely agree" and, say, 6 subquestions.
I found out how to display the answers in a "text display" question type.
But how can I display only the "don't agree at all" answers?
And how can I filter out the "non applicable" answers?

manual.limesurvey.org/Expression_Manager...e_using_placeholders
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 1 month ago #116443 by holch
Well, you will need to write an expression that first checks the value of the answer (e.g. something like "if answer1 == 1 then write "blablabla".

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.
  • eleren
  • eleren's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 1 month ago #116445 by eleren
OK, I understand, but I can't figure out the right syntax:

I tried
{if(Q1_sq001.shown=='don't agree at all')}{Q1_sq001.question}: {Q1_sq001.shown}
but his gives me a syntax error.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 1 month ago #116448 by holch
Of course, because it is not a valid EM syntax. Have a look at the examples in the manual and I think you'll figure it out.

You need to understand how the "if" loop in EM is built. Because you say "if something happens." Full stop. You closed the expression. You need to give it something to work with within {}.

Have a look at the examples here using if:

manual.limesurvey.org/Expression_Manager

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.
  • Mazi
  • Mazi's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
5 years 2 months ago #179089 by Mazi

eleren wrote: OK, I understand, but I can't figure out the right syntax:

I tried
{if(Q1_sq001.shown=='don't agree at all')}{Q1_sq001.question}: {Q1_sq001.shown}
but his gives me a syntax error.


You are Also using single quote around the to be checked text but the to be checked text contains a single quote as well. So that won't work because the quote within the text closes the expression.
In addition, the whole expression is a little wrong.

It should be like this:
{if(Q1_sq001.shown=="don't agree at all", Q1_sq001.question, Q1_sq001.shown)}

Some more notes:
1. Subquestion codes are usually like "SQ001" and not "sq001".

2. Your expression shows the question text if the answer is "don't agree..." and if not it shows the answer texts. Not sure if this is intended. Possible solution to show question text + answer text if true and nothing if false:
{if(Q1_sq001.shown=="don't agree at all", join(Q1_sq001.question, ": ", Q1_sq001.shown),"")}

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 2 months ago #179104 by DenisChenu
Whuy using .shown ? You choice "Don't agree at all" have a code, use the code ( {if(Q1_sq001.NAOK=="NOAGR", join(Q1_sq001.question, ": ", Q1_sq001.shown),"")}

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.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose