Evaluate response to question 2 depending on response to question 1

Plus d'informations
il y a 1 semaine 2 jours #183248 par DrMaggie
COM_KUNENA_MESSAGE_CREATED_NEW
Hello everybody,

my apologies if this has already been answered - didn't find anything similar to my question by searching the forum.

I want to be able to evaluate and answer a question Q2 "automatically" (requiring no action from the user) based on the response to the previous question Q1. Then, I want to be able to use the _string_ corresponding to the selected Q1 and Q2 answers in the formulation of the next question Q3.


Here's the work flow I'm envisaging:

Step 1: User actively selects one option (it's a radio button) to answer Q1

Q1: Select product to evaluate:
> Product One (answer code =A1)
> Product Two (answer code =A2)
> Product Three (answer code =A3)

Step 2: The second (hidden) question looks like this:

Q2: The link to the product specification page
> www.specs.com/product1_spec.html (answer code =S1)
> www.specs.com/product2_spec.html (answer code =S2)
> www.specs.com/product3_spec.html (answer code =S3)

Q2 should be automatically evaluated based on the answer to Q1, so that Q2=S1 if Q1=A1 etc.

Step 3: The text of the next question should contain the _text-strings_ corresponding to the selected Q1 and Q2 answers:
Q3: Have you read the specification for <text-string_of_selected_Q1_option> at <text-string_of_selected_Q2_option>?
> Yes
> No
> Not sure

....

Note that I want to make it very easy also for someone not familiar with programming to modify the survey if e.g. the links in Q2 are changed. If possible, I would therefore like to avoid using javascript, and only base the solution on "logic" and "expressions" inside the survey question definitions, that would not have to be changed if only the Q2 answer options are edited. But of course I'm open to any help & suggestions!

Thanks in advance for your help!

PS I'm using a self-hosted instance of LimeSurvey 3.15

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

LimeSurvey Partners
Plus d'informations
il y a 1 semaine 2 jours #183250 par DenisChenu
COM_KUNENA_MESSAGE_REPLIED_NEW
Q2 must be an equation question type : manual.limesurvey.org/Question_type_-_Equation

with
{if(Q1=="A1","https://example.org/spec1.html")}
{if(Q1=="A2","https://example.org/spec2.html")}
{if(Q1=="A3","https://example.org/spec3.html")}

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é: DrMaggie

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

Plus d'informations
il y a 1 semaine 2 jours #183262 par DrMaggie
COM_KUNENA_MESSAGE_REPLIED_NEW
Thank you so much, DenisChenu, for your help!

In order to display the relevant text strings in Q3, I ended up using the expression "Have you read the specification for {Q1.NAOK} at {Q2.NAOK}?", which seems to work fine.

In case anyone wants to play around with this, I have attached the .lss file:

Fichier attaché :

Nom du fichier : limesurvey...sfQ1.lss
Taille du ficher :18 ko
Pièces jointes :

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

Plus d'informations
il y a 1 semaine 2 jours #183263 par holch
COM_KUNENA_MESSAGE_REPLIED_NEW
Actually, if you don't need the URL to be saved in the database, you could actually skip the second question that is hidden and just write the equation on the question text of your Q3. As I understand, you just want to show the URL to a certain paper. Nothing else. So I don't see the need for the equation question. Of course you can use it, but I don't think it is necessary.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds
Les utilisateur(s) suivant ont remercié: DenisChenu

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

Plus d'informations
il y a 1 semaine 1 jour #183269 par DrMaggie
COM_KUNENA_MESSAGE_REPLIED_NEW
Hi holch,

thanks for your comment! Could you help me with a code example, so that I can better understand how to include the if-statement block in the Q3 text?

However, in the real-life use case that I'm trying to implement, there is a point to actually storing the link URL as such - it is our intention to allow external software packages to access the replies stored in the LimeSurvey database, and then the information needs to be as complete as possible.

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!