Welcome to the LimeSurvey Community Forum

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

How to show a text display that matchs a specific condition?

  • h1ghland3r
  • h1ghland3r's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 6 days ago #127991 by h1ghland3r
I am almost finishing my survey, you guys has been helped me a lot!
Now, I need another help, this time with logic condition (Expressions) to show text displays as a final page of the survey, but they need to match a condition.

I tried to draw my idea for better understanding :silly:


So, I have 5 categories of questions, each one has Yes/No questions. I want to know which category gets more Yes. For each scenario, I want to display a different text display. That should be the last page of the survey before the user submit.

Is that design possible?
If yes, can you help to structure the expression? I believe that should be something like this:

Scenario #1: Yes from D1A(Category A) is higher than the others categories.
(D1A.NAOK=="Y")>(D1B.NAOK=="Y") or (D1A.NAOK=="Y")>(D1C.NAOK=="Y") or (A>D) or (A>E)
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 5 days ago #128014 by tpartner
Assuming, for the sake of simplicity, that you have 2 Yes/No questions in each group, I think the relevance equation for R1 would look something like:

Code:
{sum(D1AQ1.NAOK=='Y', D1AQ2.NAOK=='Y') > sum(D2AQ1.NAOK=='Y', D2AQ2.NAOK=='Y') AND sum(D1AQ1.NAOK=='Y', D1AQ2.NAOK=='Y') > sum(D3AQ1.NAOK=='Y', D3AQ2.NAOK=='Y') AND sum(D1AQ1.NAOK=='Y', D1AQ2.NAOK=='Y') > sum(D4AQ1.NAOK=='Y', D4AQ2.NAOK=='Y') AND sum(D1AQ1.NAOK=='Y', D1AQ2.NAOK=='Y') > sum(D5AQ1.NAOK=='Y', D5AQ2.NAOK=='Y')}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • h1ghland3r
  • h1ghland3r's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 5 days ago #128024 by h1ghland3r
Thanks @tpartnet. I'll try it later.
The topic has been locked.
  • h1ghland3r
  • h1ghland3r's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 5 days ago #128031 by h1ghland3r
@tpartner,

I tried with and without { } (because the LimeSurvey shows red in the { }).
After I answered the categories (only the first one with Yes and the others with No), the text display didn't show up. Must I create a question for this text display? Because I just want to show the text display and end the survey.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 5 days ago #128034 by holch
I personally would create a equation question with the count of yes questions for each of the categories. It simplifies things and it saves the count in the database.

Then I would compare the values of these sums in another equation. I think it is a lot cleaner.

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.
  • h1ghland3r
  • h1ghland3r's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 5 days ago #128038 by h1ghland3r

holch wrote: I personally would create a equation question with the count of yes questions for each of the categories. It simplifies things and it saves the count in the database.

Then I would compare the values of these sums in another equation. I think it is a lot cleaner.


Can you give me an example how to call the equation question in the text display?
The topic has been locked.
  • h1ghland3r
  • h1ghland3r's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 4 days ago - 9 years 4 days ago #128041 by h1ghland3r
It's look like the condition is not working. The text display questions are being shown one after another independent of the choices I made.
I checked more than twice the logic that @tpartner posted. Also, I tried use Q2>Q1, Q2>Q3.. etc.

Some more tips, please =(
Last edit: 9 years 4 days ago by h1ghland3r.
The topic has been locked.
  • h1ghland3r
  • h1ghland3r's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 4 days ago #128042 by h1ghland3r
I am wondering if the conditions don't support Array question type. Maybe it's the reason I can't match the condition. In the previous steps in the same survey, I used conditions with Multiple choice question type and works fine.

:S :S :S I am almost crazy with this survey.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 4 days ago - 9 years 4 days ago #128055 by tpartner

Some more tips, please

Without knowing exactly what your question types, question codes and answer codes are, we have no way of giving an accurate relevance expression. The example given above was just that - an example for you to work from.


I am wondering if the conditions don't support Array question type.

Where do array type questions come into it. Your depiction above indicates yes/no questions followed by some text-displays.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 9 years 4 days ago by tpartner.
The topic has been locked.
  • h1ghland3r
  • h1ghland3r's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 4 days ago #128060 by h1ghland3r

tpartner wrote:

Some more tips, please

Without knowing exactly what your question types, question codes and answer codes are, we have no way of giving an accurate relevance expression. The example given above was just that - an example for you to work from.

I am wondering if the conditions don't support Array question type.

Where do array type questions come into it. Your depiction above indicates yes/no questions followed by some text-displays.


My question groups are D1A, D1B, D1C, D1D and D1E.
Inside each question group there are Array questions types with Yes (D1AA1) and No (D1AA2) answers. The codes of the subquestions are DSUB01, DSUB02, DSUB03 etc..

I used this code:
{sum(D1A_DSUB01.NAOK == 'Y', D1A_DSUB02.NAOK == 'Y', D1A_DSUB03.NAOK == 'Y', D1A_DSUB04 == 'Y') > sum(D1B_DSUB15.NAOK == 'Y', D1B_DSUB16.NAOK == 'Y', D1B_DSUB17.NAOK == 'Y', D1B_DSUB18.NAOK == 'Y', D1B_DSUB19.NAOK == 'Y', D1B_DSUB20.NAOK == 'Y', D1B_DSUB21.NAOK == 'Y', D1B_DSUB22.NAOK == 'Y', D1B_DSUB23.NAOK == 'Y', D1B_DSUB24.NAOK == 'Y', D1B_DSUB25.NAOK == 'Y', D1B_DSUB26.NAOK == 'Y', D1B_DSUB27.NAOK == 'Y', D1B_DSUB28.NAOK == 'Y', D1B_DSUB29.NAOK == 'Y', D1B_DSUB30.NAOK == 'Y', D1B_DSUB31.NAOK == 'Y') etc etc etc.. }

I tried =='Y' and =='Yes'.

After the user answer these questions, I would like to move to the text display questions (R1, R2, R3, R4 and R5) when they match the condition.

Sorry for not giving all the correct explanations since the beggining. I am not so good in English, and besides I am still learning how LimeSurvey works. My knowledge is more restricted with HTML and CSS.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 4 days ago #128061 by tpartner
You need to use the answer codes in your sum statements, not the answer display value. So if the answer codes are A1 for Yes and A2 for No, something like this:
Code:
{sum(D1A_DSUB01.NAOK == 'A1', D1A_DSUB02.NAOK == 'A1', ...

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • h1ghland3r
  • h1ghland3r's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
9 years 4 days ago - 9 years 4 days ago #128068 by h1ghland3r

tpartner wrote: You need to use the answer codes in your sum statements, not the answer display value. So if the answer codes are A1 for Yes and A2 for No, something like this:

Code:
{sum(D1A_DSUB01.NAOK == 'A1', D1A_DSUB02.NAOK == 'A1', ...


I'll try it right now. Thanks more one time.
Edit: Seems to work fine now! I'll create another conditions when I got home. I tested D1A>D1B and D1B>D1A.
Last edit: 9 years 4 days ago by h1ghland3r.
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose