Welcome to the LimeSurvey Community Forum

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

Can I Automatically select responses from source/previous question?

  • balrajGill
  • balrajGill's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 4 months ago #178356 by balrajGill
I have read Array Filters in LimeSurvey Manual, but could not accomplish this task.

Requirements:
There are 2 Single Choice Questions[list(radio)]. They are in same group and being displayed on different pages.
Q1 has 8 (1-8)options.
The requirement is to automatically select Answer A of Q2 if user selects answer 7 or 8 of Q1 and so on.

Is it possible using existing features of limeSurvey?
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 4 months ago #178371 by tpartner
If you switch to group-by-group mode, you can place an equation question in the same group as Q2, hide it with a question CSS class "hidden" and place something like this in the question text:

Code:
{Q2 = if(Q1 == '7' OR Q1 == '8', 'A', Q2)}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • balrajGill
  • balrajGill's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 4 months ago #178377 by balrajGill
Thanks for replying Tony!

I am sorry! I missed a final condition. I can't hide the question all together.
The Q2 is only displayed if user choose last answer(8 in this case) of Q1.
Also, I am new to lime survey, what is equation question?

Thanks
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 4 months ago #178379 by holch

Also, I am new to lime survey, what is equation question?


First thing you should do when you start with Limesurvey is have a look at the manual and especially the question type section. Will help you a lot to understand what is available and what can be done in Limesurvey: manual.limesurvey.org/Question_types

There you'll also find information about the equation type question.

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.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 4 months ago - 5 years 4 months ago #178387 by holch
Well, the messages that get reported end up with me somehow. ;-)

And the link I have posted is totally relevant to your question "What is equation question?", because it explains exactly what an equation question is.

It does not make sense to repeat the basics in the forum. So Tony posted a solution, and you asked about what an equation question is. And I gave you a link where you can read about equation questions. I could have written "rtfm", but no, I even posted the link where you can find the information, yet still you are complaining.

This forum is mainly run by volunteers, so we do this in our spare time. You will see that people are more than willing to help here, but if you are not willing to read links that we are posting, I guess it is not worth answering your questions anymore, because you then you are not here to learn, but to get work done for you for free.

If you have specific questions/problems with equation questions, then this is the place for the forum. But if you don't know what an equation question is, the best way is to read about it in the manual, because as I said, it makes no sense to repeat it here. Thus I posted the link.

And I think the recommendation to read through the question types page in the manual is one of the best advice I can give you about how to learn how to use Limesurvey. It helped me to better understand the tool, and it will help you as well, I am sure.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

Last edit: 5 years 4 months ago by holch.
The following user(s) said Thank You: DenisChenu, balrajGill
The topic has been locked.
More
5 years 4 months ago #178411 by surveySn
It's working,

Can I quote the answer to Array's sub-question?
The topic has been locked.
  • balrajGill
  • balrajGill's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 4 months ago #178414 by balrajGill
Hi Tony,

I am trying to achieve this:
{Q2 = if(Q1 == '1' OR Q1 == '2', 'A', if(Q1 == '3' OR Q1 == '4', 'B', if(Q1 =='5', '{//I want Q2 to appear in this condition}',Q2)))}
Q2 is hidden by default.

Can you please help.

Thanks.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 4 months ago #178449 by tpartner
Sorry, I don't get what you are doing. The example I gave sets the value of Q2, it has nothing to do with whether or not Q2 is shown (the relevance of Q2).

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.
  • balrajGill
  • balrajGill's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 4 months ago #178470 by balrajGill
Here is the actual question with conditions.
I used your solution to take values from Q51 and store in Q51B.
Moreover, I only have to show Q51B if user refuse to answer Q51(answer code 13). If have tried setting condition for this but I not getting responses.


Q51. In what year were you born? (DO NOT READ CATEGORIES; CODE AS APPROPRIATE)
1. 1943 or earlier
2. 1944-1948
3. 1949-1953
4. 1954-1958
5. 1959-1963
6. 1964-1968
7. 1969-1973
8. 1974-1978
9. 1979-1983
10. 1984-1988
11. 1989-1993
12. 1994-2000
13. (Refused)

51B.[AGE RANGE - CODE FROM PREVIOUS QUESTION]
[IF Q51=1989 thru 2000 Q51B=1]
[IF Q51=1979 thru 1988 Q51B=2]
[IF Q51=1969 thru 1978 Q51B=3]
[IF Q51=1954 thru 1968 Q51B=4]
[IF Q51=1953 or earlier Q51B=5]
(IF REFUSED THEN ASK FOLLOWUP: “Which age group are you in? (READ LIST)…”)
1. 18-29
2. 30-39
3. 40-49
4. 50-64
5. 65 or over
6. (Refused)
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 4 months ago #178474 by tpartner
Please refer to the manual.

Completely separate from setting the value of Q51B, you can set a relevance equation for Q51B to hide/show it:

Code:
Q51 == '13'

- manual.limesurvey.org/Questions_-_introduction#General_options

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, balrajGill
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 4 months ago #178476 by DenisChenu

tpartner wrote: …
Completely separate from setting the value of Q51B, you can set a relevance equation for Q51B to hide/show it:

Yes, but here : seems more an "hidden" but don't delete values :).

If Q51 and Q51B are on different page :

Add CSS class:
{if(Q51.NAOK == '13'," hidden","")}

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 following user(s) said Thank You: balrajGill
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 4 months ago #178477 by holch
And on a general note: I highly doubt that someone who refuses to answer the range of their birth year will want to answer their age range.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The following user(s) said Thank You: DenisChenu
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose