Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: conditions...

conditions... 3 years 3 months ago #62594

  • claudio123
  • claudio123's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 31
  • Thank you received: 1
  • Karma: 0
Hello,

I need help for a survey I am building. So far everything looks fine but the problem begins with conditions:

I have a list of 20 questions, that can all be answered "1", "2" or "3".

Depending on the answers to the first two questions I want this:

if not both are answered "3" jump to question 20, otherwise answer questions
3 - 19, that can also be asnwered "1", "2" or "3"

So far everything is fine, I make a rule for question 3, so it will only show if 1 and 2 are answered "3", then copy that rule to q4 - q19.

Now to the tricky part:

Depending on the answers to the questions 3 - 9 I want the questions 10 - 19 to display, but:

Only If at least 5 of the questions 3 - 9 are answered "3" I want to display the questions 10 - 19.

How do I write those rules?

It looks VERY complicated to write down all possibilities:


if q3 = "3"
and
if q4 = "3"
and
if q5 = "3"
and
if q6 = "3"
and
if q7 = "3"

or

if q3 = "3"
and
if q4 = "3"
and
if q5 = "3"
and
if q6 = "3"
and
if q8 = "3"

or

if q3 = "3"
and
if q4 = "3"
and
if q5 = "3"
and
if q6 = "3"
and
if q9 = "3"

or

if q3 = "3"
and
if q4 = "3"
and
if q5 = "3"
and
if q7 = "3"
and
if q8 = "3"

if q3 = "3"
and
if q4 = "3"
and
if q5 = "3"
and
if q7 = "3"
and
if q9 = "3"

if q3 = "3"
and
if q4 = "3"
and
if q5 = "3"
and
if q6 = "3"
and
if q7 = "3"

if q3 = "3"
and
if q4 = "3"
and
if q6 = "3"
and
if q7 = "3"
and
if q8 = "3"

if q3 = "3"
and
if q4 = "3"
and
if q6 = "3"
and
if q7 = "3"
and
if q9 = "3"

and so on .....

How do I achieve this?

Thanks,
best regards

claudio
... lost in brackets ...
(I suggest a preview option for posting in the forum)
Last Edit: 3 years 3 months ago by claudio123.
The administrator has disabled public write access.

Aw: conditions... 3 years 3 months ago #62615

  • Zappes
  • Zappes's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 20
  • Karma: 0
Hey Claudio,
instead of writing conditions you could try this by programming rules in javacript. works much easier.
The administrator has disabled public write access.

Re: conditions... 3 years 3 months ago #62622

  • claudio123
  • claudio123's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 31
  • Thank you received: 1
  • Karma: 0
Thanks for your answer, Zappes.
Using javascript will however ask for a new page, I think.

And how do I translate this in Java?

"Only show this question (and the next ones...) if at least 5 out of the questions 3 - 9 are answered '3' "

I am currently investigating a java script that checked the answers to an array, so maybe I find an answer there, but I stll have to get used to java's language of mathematics...

Thanks + best regards!

Claudio
... lost in brackets ...
(I suggest a preview option for posting in the forum)
The administrator has disabled public write access.

Re: conditions... 3 years 3 months ago #62626

  • TMSWhite
  • TMSWhite's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 759
  • Thank you received: 82
  • Karma: 36
Claudio-

Another option we're exploring via a new, optional, Relevance functionality (issue 5269), would let you set this as the condition:

count(q3==3,q4==3,q5==3,q6==3,q7==3,q8==3,q9==3) >= 5

You'd apply that condition to each of the questions q10-q19 (of if they are all in the same group, you can just apply that condition to the group), and it will ensure that questions 10-19 are only displayed if at least 5 of q3-q9 were answered 3.

-Tom
The administrator has disabled public write access.
The following user(s) said Thank You: claudio123

Re: conditions... 3 years 3 months ago #62627

  • claudio123
  • claudio123's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 31
  • Thank you received: 1
  • Karma: 0
Tom,

this is exactly what I was looking for - is there any possibility to have this as an addon or implemented on my install now?
I'm on Version 1.91+ Build 10315 and not too familiar with limesurvey. I have it installed two days ago locally on a virtual machine (virtualbox) using turnkey linux and managed to update to this latest version from a Version 1.8(?).

Thanks again for showing me this possibility that I now not only want but NEED :-))

best regards

Claudio
... lost in brackets ...
(I suggest a preview option for posting in the forum)
Last Edit: 3 years 3 months ago by claudio123. Reason: typo
The administrator has disabled public write access.

Re: conditions... 3 years 3 months ago #62633

  • TMSWhite
  • TMSWhite's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 759
  • Thank you received: 82
  • Karma: 36
Claudio-

Glad to hear this is of potential value.

The ExpressionManager is operational (it can process the count(q3==3, ...) expression and give the right answer) - see patch for issue 5268. However, it isn't integrated with conditions yet. That's one of my next tasks and I hope to be done in a few weeks.

/Tom
The administrator has disabled public write access.

Re: conditions... 3 years 3 months ago #62635

  • claudio123
  • claudio123's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 31
  • Thank you received: 1
  • Karma: 0
- the show/hide solution shown in this thread by Tony (tpartner) might show a workaround that might allow conditional branching based on your Expression Manager (solving more complex mathematical challenges).

I'll have a look and try to patch my limesurvey install.

Thanks and best regards

Claudio
... lost in brackets ...
(I suggest a preview option for posting in the forum)
The administrator has disabled public write access.

Re: conditions... 3 years 3 months ago #62642

  • claudio123
  • claudio123's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 31
  • Thank you received: 1
  • Karma: 0
Well, the patch did not work :-(

root@lamp:/var/www# patch -p0 --dry-run < issue*
(Stripping trailing CRs from patch.)
patching file admin/dataentry.php
(Stripping trailing CRs from patch.)
patching file admin/printablesurvey.php
(Stripping trailing CRs from patch.)
patching file classes/dTexts/dTexts.php
Hunk #1 FAILED at 12.
1 out of 1 hunk FAILED -- saving rejects to file classes/dTexts/dTexts.php.rej
(Stripping trailing CRs from patch.)
patching file classes/eval/ExpressionManager.php
(Stripping trailing CRs from patch.)
patching file classes/eval/LimeExpressionManager.php
(Stripping trailing CRs from patch.)
patching file classes/eval/Test_ExpressionManager_Evaluate.php
(Stripping trailing CRs from patch.)
patching file classes/eval/Test_ExpressionManager_ProcessStringContainingExpressions.php
(Stripping trailing CRs from patch.)
patching file classes/eval/Test_ExpressionManager_Tokenizer.php
(Stripping trailing CRs from patch.)
patching file common_functions.php
(Stripping trailing CRs from patch.)
patching file printanswers.php
Hunk #1 FAILED at 278.
1 out of 1 hunk FAILED -- saving rejects to file printanswers.php.rej
(Stripping trailing CRs from patch.)
patching file save.php

looks like there is some more work to be done for me ...

regards
Claudio
... lost in brackets ...
(I suggest a preview option for posting in the forum)
The administrator has disabled public write access.

Re: conditions... 3 years 3 months ago #62646

  • tpartner
  • tpartner's Avatar
  • NOW ONLINE
  • LimeSurvey Team
  • Posts: 4208
  • Thank you received: 791
  • Karma: 360
claudio123, are all questions on the same page? Or at least Q3-Q9?

If so we can use JavaScript to put a listener on them and populate a hidden question if at least 5 of them are answered "3".
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Re: conditions... 3 years 3 months ago #62648

  • claudio123
  • claudio123's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 31
  • Thank you received: 1
  • Karma: 0
Yes, I want all of them on the same page, I even think about putting them all in an array, but that should not make a big difference.
I tried your solution from here (..forum/can-i-do-this-with-limesurvey/58002-using-previous-array-question-responses-to-set-following-array-subquestions) but I also failed. :-S
I'd like to send you a tiny survey with your solution form that thread that is not fully functional..
Thanks and best regards
Claudio
... lost in brackets ...
(I suggest a preview option for posting in the forum)
Last Edit: 3 years 3 months ago by claudio123.
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.157 seconds
Donation Image