Welcome to the LimeSurvey Community Forum

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

Dynamic Question Logics

  • urbana
  • urbana's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
5 years 9 months ago #170397 by urbana
Dynamic Question Logics was created by urbana
Hi I have a question type Array (Numbers)
My problem:
- I don't know how many answers are shown
(I use the filter option)
- I don't know how many answers the user has to give

Example:
- I show him in a multiple choise question 40 answers
- he chooses X items
- I only show in the array those X items
BUT
if X is >= 5 then the should demand min 5 and max 5 answers and show numbers from 1 to 5
if X is < 5 there are other options.

My question, can I change the logic of the question during runtime via JS or are there possiblities to add conditions in the logic expressions?
The topic has been locked.
  • urbana
  • urbana's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
5 years 9 months ago - 5 years 9 months ago #170402 by urbana
Replied by urbana on topic Dynamic Question Logics
I played around and tried to use expressions in the field maximum
So minimum is always one but maximum should be that logic:
if(count(that.effectYes.NAOK)>=5,5,count(that.effectYes.NAOK))

But all I get in the dropdowns is always 1 and 0

And in the overview of the questions, the logic expression looks like that - what looks to me like an error:
(check out the attachement)

I also tried a sample if:
if(5>6,5,3)

result, again 1 and 0
Last edit: 5 years 9 months ago by urbana.
The topic has been locked.
  • urbana
  • urbana's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
5 years 9 months ago #170417 by urbana
Replied by urbana on topic Dynamic Question Logics
Anyone an idea? It's really important
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 9 months ago #170433 by tpartner
Replied by tpartner on topic Dynamic Question Logics
Expressions do work in the min/max answers fields for me - see attached survey.







File Attachment:

File Name: limesurvey...6-27.lss
File Size:28 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • urbana
  • urbana's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
5 years 9 months ago #170434 by urbana
Replied by urbana on topic Dynamic Question Logics
Hi I good to know - this I also what I need but I need maximum number not answer.
As you know in array(number) I have dropdowns from min to max and I want to set the max.
And that doesn't work
The topic has been locked.
  • urbana
  • urbana's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
5 years 9 months ago #170436 by urbana
Replied by urbana on topic Dynamic Question Logics
So here is your survey back but I changed the type to Array(number) and added the if function in the maximum field.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 9 months ago #170437 by tpartner
Replied by tpartner on topic Dynamic Question Logics
Sorry, I misunderstood the requirements. In that case, I think you will need to remove the drop-down options with JavaScript.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • urbana
  • urbana's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
5 years 9 months ago #170439 by urbana
Replied by urbana on topic Dynamic Question Logics
OK thx anyway!
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose