- Posts: 39
- Thank you received: 3
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
How to show the previous answer?
- mariaa
- Topic Author
- Offline
- Junior Member
Less
More
5 years 2 months ago #180579
by mariaa
How to show the previous answer? was created by mariaa
Hi all ,
I´ve created a quiz and on the last page I´d like to create an overview of all answers the participant has made.
Below, please find an example on how this would look like for the following exemplary question.
A1 "Which of the following statistical methods are multivariate?" (multiple choice)
SQ001 Cluster analysis
SQ002 Variance
SQ003 Cross-tabulation
SQ004 Multiple regression
Let's assume that the participant has chosen "Cluster analysis" and "Cross-Tabulation" in this case. (Of course he also might have selected different answers).
Overview text:
"Question : Which of the following statistical methods are multivariate?
Your answer: "Cluster analysis" and "Cross-Tabulation"
How do I generate the overview text (especially the "Your answer: "Cluster analysis" and "Cross-Tabulation" part)? What would the syntax look like?
Kind regards and thanks a lot
Maria
I´ve created a quiz and on the last page I´d like to create an overview of all answers the participant has made.
Below, please find an example on how this would look like for the following exemplary question.
A1 "Which of the following statistical methods are multivariate?" (multiple choice)
SQ001 Cluster analysis
SQ002 Variance
SQ003 Cross-tabulation
SQ004 Multiple regression
Let's assume that the participant has chosen "Cluster analysis" and "Cross-Tabulation" in this case. (Of course he also might have selected different answers).
Overview text:
"Question : Which of the following statistical methods are multivariate?
Your answer: "Cluster analysis" and "Cross-Tabulation"
How do I generate the overview text (especially the "Your answer: "Cluster analysis" and "Cross-Tabulation" part)? What would the syntax look like?
Kind regards and thanks a lot
Maria
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
5 years 2 months ago - 5 years 2 months ago #180582
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic How to show the previous answer?
Try something like this:
Code:
Your answer: {if(A1_SQ001 == 'Y', ,'"Cluster analysis"', '')}{if(A1_SQ001 == 'Y' AND count(A1_SQ002, A1_SQ003, A1_SQ004) > 0, ', ', '')}{if(A1_SQ002 == 'Y', ,'"Variance"', '')}{if(A1_SQ002 == 'Y' AND count(A1_SQ003, A1_SQ004) > 0, ', ', '')}{if(A1_SQ003 == 'Y', ,'"Cross-Tabulation"', '')}{if(A1_SQ003 == 'Y' AND A1_SQ004 == 'Y', ', ', '')}{if(A1_SQ004 == 'Y', ,'"Multiple regression"', '')}.
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 5 years 2 months ago by tpartner.
The following user(s) said Thank You: mariaa
The topic has been locked.
- mariaa
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 39
- Thank you received: 3
5 years 1 month ago #180650
by mariaa
Replied by mariaa on topic How to show the previous answer?
Hi Tpartner,
thanks a lot for your approach on this!
I tried out your syntax and had to delete some commas (The error warnings told me so). After having solved this problem, I received the following error message: " Undefined variable".
Do you have any idea where the error is and how I need to adjust my syntax?
Your answer: {if(A1_SQ001 == 'Y',"Cluster analysis"', '')}{if(A1_SQ001 == 'Y' AND count(A1_SQ002, A1_SQ003, A1_SQ004) > 0, ', ', '')}{if(A1_SQ002 == 'Y',"Variance"', '')}{if(A1_SQ002 == 'Y' AND count(A1_SQ003, A1_SQ004) > 0, ', ', '')}{if(A1_SQ003 == 'Y','"Cross-Tabulation"', '')}{if(A1_SQ003 == 'Y' AND A1_SQ004 == 'Y', ', ', '')}{if(A1_SQ004 == 'Y','"Multiple regression"', '')}.
Kind regards and many thanks
Larissa Rose
thanks a lot for your approach on this!
I tried out your syntax and had to delete some commas (The error warnings told me so). After having solved this problem, I received the following error message: " Undefined variable".
Do you have any idea where the error is and how I need to adjust my syntax?
Your answer: {if(A1_SQ001 == 'Y',"Cluster analysis"', '')}{if(A1_SQ001 == 'Y' AND count(A1_SQ002, A1_SQ003, A1_SQ004) > 0, ', ', '')}{if(A1_SQ002 == 'Y',"Variance"', '')}{if(A1_SQ002 == 'Y' AND count(A1_SQ003, A1_SQ004) > 0, ', ', '')}{if(A1_SQ003 == 'Y','"Cross-Tabulation"', '')}{if(A1_SQ003 == 'Y' AND A1_SQ004 == 'Y', ', ', '')}{if(A1_SQ004 == 'Y','"Multiple regression"', '')}.
Kind regards and many thanks
Larissa Rose
Attachments:
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
5 years 1 month ago #180651
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic How to show the previous answer?
Sorry, without a small sample survey I have no way of debugging that.
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: mariaa
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
5 years 1 month ago - 5 years 1 month ago #180664
by DenisChenu
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.
Replied by DenisChenu on topic LHow to show the previous answer?
Looking at screenshot
{if(A1_SQ001 == 'Y',"Cluster analysis"', '')}
I put the extra ' in bold and red
{if(A1_SQ001 == 'Y',"Cluster analysis"', '')}
I put the extra ' in bold and red
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.
Last edit: 5 years 1 month ago by DenisChenu.
The following user(s) said Thank You: mariaa
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
5 years 1 month ago - 5 years 1 month ago #180699
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic LHow to show the previous answer?
I think there's actually a missing single-quote. I think Larissa wants the double-quotes in the piped text.
Code:
{if(A1_SQ001 == 'Y','"Cluster analysis"', '')}
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 5 years 1 month ago by tpartner.
The topic has been locked.
- mariaa
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 39
- Thank you received: 3
5 years 1 month ago #180754
by mariaa
Replied by mariaa on topic How to show the previous answer?
Dear all,
thanks a lot for your fast feedback on this. I adjusted the single quote but now the syntax is not completely recognized.
Do you have any ideas where the mistake is?
@Tpartner: I didn´t know about the possibility of adding sample surveys . Thanks, this might be very helpful for all future problems I attached the survey for this question below.
thanks a lot for your fast feedback on this. I adjusted the single quote but now the syntax is not completely recognized.
Do you have any ideas where the mistake is?
@Tpartner: I didn´t know about the possibility of adding sample surveys . Thanks, this might be very helpful for all future problems I attached the survey for this question below.
Attachments:
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10099
- Thank you received: 3589
5 years 1 month ago #180760
by tpartner
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Replied by tpartner on topic How to show the previous answer?
It's broken because you removed one of the required single-quotes.
This works:
Sample survey attached:
This works:
Code:
{if(A1_SQ001 == 'Y','"Cluster analysis"', '')}{if(A1_SQ001 == 'Y' AND count(A1_SQ002, A1_SQ003, A1_SQ004) gt 0, ', ', '')}{if(A1_SQ002 == 'Y','"Variance"', '')}{if(A1_SQ002 == 'Y' AND count(A1_SQ003, A1_SQ004) gt 0, ', ', '')}{if(A1_SQ003 == 'Y','"Cross-Tabulation"', '')}{if(A1_SQ003 == 'Y' AND A1_SQ004 == 'Y', ', ', '')}{if(A1_SQ004 == 'Y','"Multiple regression"', '')}
Sample survey attached:
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: mariaa
The topic has been locked.
- mariaa
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 39
- Thank you received: 3
5 years 1 month ago #180936
by mariaa
Replied by mariaa on topic How to show the previous answer?
Thanks a lot, it´s working now
The topic has been locked.
- Joffm
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12881
- Thank you received: 3965
5 years 1 month ago #180938
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
Replied by Joffm on topic How to show the previous answer?
Hi,
wouldn't it be easier to use the "list" function?
Your answer: {list(if(A1_SQ001 == 'Y','"Cluster analysis"', ''),if(A1_SQ002 == 'Y','"Variance"', ''),if(A1_SQ003 == 'Y','"Cross-Tabulation"', ''),if(A1_SQ004 == 'Y','"Multiple regression"', ''))}.
Joffm
wouldn't it be easier to use the "list" function?
Your answer: {list(if(A1_SQ001 == 'Y','"Cluster analysis"', ''),if(A1_SQ002 == 'Y','"Variance"', ''),if(A1_SQ003 == 'Y','"Cross-Tabulation"', ''),if(A1_SQ004 == 'Y','"Multiple regression"', ''))}.
Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: DenisChenu, mariaa
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
5 years 1 month ago #180960
by DenisChenu
And with self : list(self.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.
Replied by DenisChenu on topic How to show the previous answer?
Yes !Joffm wrote: Hi,
wouldn't it be easier to use the "list" function?
And with self : list(self.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 following user(s) said Thank You: mariaa
The topic has been locked.
- mariaa
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 39
- Thank you received: 3
5 years 1 month ago #181301
by mariaa
Replied by mariaa on topic How to show the previous answer?
Thanks a lot! Seems to be an easy alternative
The topic has been locked.