tailoring array sub-question

Plus d'informations
il y a 4 ans 11 mois #97831 par first
first a créé le sujet : tailoring array sub-question
There is an array type question to rate 3 cars. BMW,AUDI and Honda(sub-questions). The answers (rating options) are Good,Satisfactory and Poor. I have to show the car name that is rated good in the question text of next question.Is there any method to access the sub-question label.:)

Survey Designer and Programmer

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 4 ans 11 mois #97842 par DenisChenu
DenisChenu a répondu au sujet : tailoring array sub-question
Hello:

Qcode.question

The for question with sub-question:
{QCODE_SQcode.question}

Somethink like this maybe:
{if(QCODE_SQ001=="GOOD",join("You like ",QCODE_SQ001.question),"")}

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .
Les utilisateur(s) suivant ont remercié: first

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 2 mois 6 jours - il y a 2 mois 6 jours #167214 par torrido23
torrido23 a répondu au sujet : tailoring array sub-question
Hello,

sorry I know this thread is already quite old, but I wanted to refrain from opening a new thread (yet).

I have almost exactly the same problem, but the abovementioned syntax of DenisChenu does not work.
If I have "QCODE_SQ001.question" in the if expression it does not do anything. However, if I change ".question" to ".shown" it works just fine.

Is this a bug or what am I missing?

Thanks a lot!
Dernière édition: il y a 2 mois 6 jours par torrido23.

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 2 mois 6 jours #167246 par Joffm
Joffm a répondu au sujet : tailoring array sub-question
Hi,
we don't know what you intend to do.

But with this expression
{join(if(Q1_SQ001==1,Q1_SQ001.question,""),if(Q1_SQ002==1,Q1_SQ002.question,""),if(Q1_SQ003==1,Q1_SQ003.question,""))}

you get the following




So, the best is you explain your problem a bit more detalled.

Joffm
Pièces jointes :

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 2 mois 5 jours #167263 par torrido23
torrido23 a répondu au sujet : tailoring array sub-question
Hey,

thank you very much for your answer! I am sorry. I should have been more precise.
I am not exactly trying to "join" certain statements, but my issues is fairly similar (I think).

I am trying to use subquestions from an array-question as "preloads" for a multiple choice question.

Q1 would be something like "How often do you drink these beverages?" and participants shall say if they drink "coke", "sprite", "water", which are the sub-questions, "everyday", "every week", "every month", "never", which are the answer categories.

In a follow up multiple choice question Q2, I want to ask "What do you prefer?" and I want to list the aforementioned beverages in brackets if participants tick "everyday" in Q1. (I obviously have other answer categories in this question)
[ ] Beverages (beverages)
[ ] non-relevant answer category
[ ] non-relevant answer category

My code for Q2 looks like (A1 is the answer code.):
Beverages ( {if(Q1_SQ001 == "A1", Q1_SQ001.question, )} {if(Q1_SQ001 == "A1", Q1_SQ002.question, )} {if(Q1_SQ001 == "A1", Q1_SQ003.question, )} )

However, this does not work. What works is this, however:
{if(Q1_SQ001 == "A1", Q1_SQ001.shown, )} {if(Q1_SQ001 == "A1", Q1_SQ002.shown, )} {if(Q1_SQ001 == "A1", Q1_SQ003.shown, )}

This prints "everyday" if this category is ticked.
Moreover, if I use the expression "Q1_SQ001.question" outside of the if-expression, it prints me the correct subquestion ("coke", "sprite", "water").

I also tried to run your code and it does not work.

I hope this made it clearer. If not, then I will upload a sample survey with my issue.


Thank you very much for your help!

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 2 mois 5 jours #167265 par Joffm
Joffm a répondu au sujet : tailoring array sub-question
Hi,
I still do not know exactly what you are going to do.
Okay: This is Q1:


1. Is this your second question?


Here you only enter in the subquestion text:
{join(if(Q1_SQ001=="A1",Q1_SQ001.question + " ",""),if(Q1_SQ002=="A1",Q1_SQ002.question+ " ",""),if(Q1_SQ003=="A1",Q1_SQ003.question+ " ",""),if(Q1_SQ004=="A1",Q1_SQ004.question+ " ",""),if(Q1_SQ005=="A1",Q1_SQ005.question+ " ",""),if(Q1_SQ006=="A1",Q1_SQ006.question+ " ",""))}

2. Or is it this?


Here you just add the subquestion relevance:



And if you are trying to do something quite different, send a sample *.lss

Best regards
Joffm
Pièces jointes :

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 2 mois 5 jours #167266 par torrido23
torrido23 a répondu au sujet : tailoring array sub-question
Thanks again for your quick reply!

The first part of your answer is what I want to do. It just does not work for me. I copied your code but I don't get the result. The "coke", "water", "tomato juice" are not printed in the mc-question.

I added an example survey with arbitrary example questions. I hope this makes my issues clearer.

Best wishes
Pièces jointes :

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 2 mois 5 jours #167267 par Joffm
Joffm a répondu au sujet : tailoring array sub-question
Hi,

1. You didn't say that there were two different question types before.
2. You did not enter anything - the "join" command.





Here a working example.

Fichier attaché :

Nom du fichier : limesurvey...4424.lss
Taille du ficher :20 ko


Of course you have to check if there is anything to display in Music resp. Movies (best with the functions "count" rep. "countifop")
See: https://manual.limesurvey.org/Expression_Manager#Implemented_Functions

Regards
Joffm
Pièces jointes :

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 2 mois 5 jours - il y a 2 mois 5 jours #167276 par torrido23
torrido23 a répondu au sujet : tailoring array sub-question
Much appreciated! Your advice really helped! Thanks for your effort.
Dernière édition: il y a 2 mois 5 jours par torrido23.

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 1 mois 4 semaines #167558 par torrido23
torrido23 a répondu au sujet : tailoring array sub-question
Hey,

sorry, I have to ask a follow-up question. The provided solution worked absolutely fine, until I tried to show the whole survey on one page. It seems to be the case that the survey has to be presented either question by question or group by group for processing the condition containing the ".question"-part correctly.
However, the project I am working on does only allow for the "all on one page"-version. Is there a solution for this problem or is there anything I am missing?

Thank you very much and best regards

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 1 mois 4 semaines #167560 par Joffm
Joffm a répondu au sujet : tailoring array sub-question
Hi,
at the moment i do not see why it doesn't work.
The multiple works, but the array does not.

I'l have a look.

Nevertheless, you could hardcode the genres.
Instead of Q2_SQ001.question" just enter "Horror"

Joffm

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 1 mois 4 semaines #167562 par torrido23
torrido23 a répondu au sujet : tailoring array sub-question
Wow, that's an incredibly easy solution. That will do. I feel a little embarassed that I have not thought about just hardcoding it .... Thank you very much!

Connexion ou Créer un compte pour participer à la conversation.

Commencez dès maintenant !

Créez simplement un compte et commencez à utiliser LimeSurvey dès aujourd'hui.

Inscrivez-vous maintenant

Inscrivez-vous à notre Newsletter!