How to show the previous answer?

More
4 months 1 week ago #180579 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

Please Log in or Create an account to join the conversation.

LimeSurvey Partners
More
4 months 1 week ago - 4 months 1 week ago #180582 by tpartner
Try something like this:

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.
Official LimeSurvey Partner - partnersurveys.com
Last edit: 4 months 1 week ago by tpartner.
The following user(s) said Thank You: mariaa

Please Log in or Create an account to join the conversation.

More
4 months 5 days ago #180650 by mariaa
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
Attachments:

Please Log in or Create an account to join the conversation.

More
4 months 5 days ago #180651 by tpartner
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.
Official LimeSurvey Partner - partnersurveys.com
The following user(s) said Thank You: mariaa

Please Log in or Create an account to join the conversation.

More
4 months 5 days ago - 4 months 5 days ago #180664 by DenisChenu
Looking at screenshot

{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 .
An error happen ? Before make a new topic : remind the Debug mode .
Last edit: 4 months 5 days ago by DenisChenu.
The following user(s) said Thank You: mariaa

Please Log in or Create an account to join the conversation.

More
4 months 4 days ago - 4 months 4 days ago #180699 by tpartner
I think there's actually a missing single-quote. I think Larissa wants the double-quotes in the piped text.

{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.
Official LimeSurvey Partner - partnersurveys.com
Last edit: 4 months 4 days ago by tpartner.

Please Log in or Create an account to join the conversation.

More
4 months 4 days ago #180754 by mariaa
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 =P I attached the survey for this question below.

File Attachment:

File Name: limesurvey...7444.lss
File Size:18 KB


:)
Attachments:

Please Log in or Create an account to join the conversation.

More
4 months 4 days ago #180760 by tpartner
It's broken because you removed one of the required single-quotes.

This works:

{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:

File Attachment:

File Name: limesurvey...4441.lss
File Size:19 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Official LimeSurvey Partner - partnersurveys.com
Attachments:
The following user(s) said Thank You: mariaa

Please Log in or Create an account to join the conversation.

More
4 months 8 hours ago #180936 by mariaa
Thanks a lot, it´s working now =P

Please Log in or Create an account to join the conversation.

More
4 months 7 hours ago #180938 by Joffm
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


Volunteers are not paid.
Not because they are worthless, but because they are priceless
Attachments:
The following user(s) said Thank You: DenisChenu, mariaa

Please Log in or Create an account to join the conversation.

More
3 months 4 weeks ago #180960 by DenisChenu

Joffm wrote: Hi,
wouldn't it be easier to use the "list" function?

Yes !

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 .
An error happen ? Before make a new topic : remind the Debug mode .
The following user(s) said Thank You: mariaa

Please Log in or Create an account to join the conversation.

More
3 months 2 weeks ago #181301 by mariaa
Thanks a lot! Seems to be an easy alternative =)

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!