Welcome to the LimeSurvey Community Forum

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

How can i set a value for a list(radio) question based on answer to previous que

  • douerliang
  • douerliang's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
7 years 11 months ago #135051 by douerliang
Hello everyone!

I'm back again with a complex problem. hahahaha....

Such as the title,I want to set a value for a list(radio) question based on answer to previous question, but I don't know how to do it.

I searched a number of posts.
For example:
Using assignment operator to set a default value for a list type question

Set the answer for one question based on answer to previous question

This solution is realized through javascript.

But I want do it use EM.

Can someone help me?

I'm sorry for my english!
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 11 months ago #135071 by tpartner
You can use the assignment operator in an equation question placed after the question to be manipulated. In this example Q2 will be set to "A1" if Q1 is "A1", otherwise Q2 will be set to "A2".

Code:
{Q2=if(Q1=="A1","A1","A2")}

Sample survey attached:

File Attachment:

File Name: limesurvey...1-12.lss
File Size:16 KB

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: douerliang
The topic has been locked.
  • douerliang
  • douerliang's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
7 years 11 months ago #135101 by douerliang
hi, tpartner,thank you for your replay.

the solutions you provided is good.

But I still want to know How can i set a value for a list(radio) question based on answer to previous question?

The question type is List(Radio) instead of equation question.

Please forgive me into a dead end!(stubborn)

I'm sorry for my english!

Certainly must learn English!
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 11 months ago #135106 by tpartner

But I still want to know How can i set a value for a list(radio) question based on answer to previous question?

That's exactly what my sample survey does. Did you try it???

The equation question is used to set the radio question.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • douerliang
  • douerliang's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
7 years 11 months ago #135137 by douerliang
tpartner,thank you for reminding.
The sample survey you provided is a perfect solution to the problem.
I'm sorry for my not serious.
Once again, thank you.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose