- Posts: 4
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Redirect to one of two different end URLs
- wshead
- Topic Author
- Offline
- New Member
Less
More
7 years 9 months ago #139057
by wshead
Redirect to one of two different end URLs was created by wshead
I would like to automatically redirect participants at the end of my survey to one of two different URLs, depending on their answers to questions in the survey. Is this possible?
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3593
7 years 9 months ago #139059
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 Redirect to one of two different end URLs
Yes, you can use Expression Manager to pipe in the appropriate URL.
It may be easiest to place the URLs in separate equation type questions, then your end URL could be an expression like:
It may be easiest to place the URLs in separate equation type questions, then your end URL could be an expression like:
Code:
{if(q1 == 1, equation1, equation2)}
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: wshead
The topic has been locked.
- wshead
- Topic Author
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
7 years 9 months ago #139060
by wshead
Replied by wshead on topic Redirect to one of two different end URLs
Thank you for your help and prompt reply, Tony.
I"m very much a beginner when it comes to this stuff. I'm not sure what you mean by "separate equation type questions." Perhaps you could provide a quick model of what exactly would be entered into the "End URL" box under General Settings with the following parameters:
Answer to q1 = 1, end URL is abc.com
Answer to q1 = 2, end URL is xyz.com
Thanks again.
I"m very much a beginner when it comes to this stuff. I'm not sure what you mean by "separate equation type questions." Perhaps you could provide a quick model of what exactly would be entered into the "End URL" box under General Settings with the following parameters:
Answer to q1 = 1, end URL is abc.com
Answer to q1 = 2, end URL is xyz.com
Thanks again.
The topic has been locked.
- holch
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 11658
- Thank you received: 2742
7 years 9 months ago #139064
by holch
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
Replied by holch on topic Redirect to one of two different end URLs
He provided it already. Create two equation questions, in equation1 you put the url abc.com, in the second one you put the URL xyz.com.
Then use the code Tpartner was giving in the End URL field. It will check if the code is 1, then it will use the content of equation1 and if not it will use the value of equation2.
Then use the code Tpartner was giving in the End URL field. It will check if the code is 1, then it will use the content of equation1 and if not it will use the value of equation2.
I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.
The following user(s) said Thank You: tpartner, wshead
The topic has been locked.
- wshead
- Topic Author
- Offline
- New Member
Less
More
- Posts: 4
- Thank you received: 0
7 years 9 months ago #139225
by wshead
Replied by wshead on topic Redirect to one of two different end URLs
Thank you. As I mentioned I'm very much a beginner at LS. To give you an idea it took me a while to figure out that I was supposed to simply enter the URL into the question field of the equation question (I thought I needed to enter an actual equation with = symbols and such).
The topic has been locked.
- nique
- Offline
- Junior Member
Less
More
- Posts: 29
- Thank you received: 0
7 years 6 months ago - 7 years 6 months ago #143412
by nique
Replied by nique on topic Redirect to one of two different end URLs
Apologies for posting to an old post but this works perfectly for me except I am struggling with EM.
How would I adjust the IF statement for 4 equations?
If 1 - Web A, if 2 - Web B, if 3 - Web C, if 3 - Web D.
I have this but it does not seem to be working - if(A1 == 1, equation1, if(A1 == 2, equation2, if(A1 == 3, equation3, if(A1 == 4, equation4))))
Thank you.
How would I adjust the IF statement for 4 equations?
If 1 - Web A, if 2 - Web B, if 3 - Web C, if 3 - Web D.
I have this but it does not seem to be working - if(A1 == 1, equation1, if(A1 == 2, equation2, if(A1 == 3, equation3, if(A1 == 4, equation4))))
Thank you.
Last edit: 7 years 6 months ago by nique.
The topic has been locked.
- Ben_V
- Offline
- Platinum Member
Less
More
- Posts: 1128
- Thank you received: 329
7 years 6 months ago #143422
by Ben_V
Benoît
EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Replied by Ben_V on topic Redirect to one of two different end URLs
Try something around:
Code:
{if(A1 == 1, equation1, if(A1 == 2, equation2, if(A1 == 3, equation3, equation4)))}
Benoît
EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
The following user(s) said Thank You: nique
The topic has been locked.
- nique
- Offline
- Junior Member
Less
More
- Posts: 29
- Thank you received: 0
7 years 6 months ago #143458
by nique
Replied by nique on topic Redirect to one of two different end URLs
EM will be the death of me.
THANK YOU!
THANK YOU!
The topic has been locked.
- Ben_V
- Offline
- Platinum Member
Less
More
- Posts: 1128
- Thank you received: 329
7 years 6 months ago - 7 years 6 months ago #143475
by Ben_V
Em don't use a strict " if -> else if -> else " syntax but it's pretty the same and easier than you can expect...
equation1 = if statement
equation2 = else if statement
equation3 = else if statement
equation4 = else statement
Remember that there are buttons (at survey/group/question level) to check your EM syntax
For more complex equations, you can use some line break for more readability
Benoît
EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Replied by Ben_V on topic Redirect to one of two different end URLs
nique wrote: EM will be the death of me.
Em don't use a strict " if -> else if -> else " syntax but it's pretty the same and easier than you can expect...
equation1 = if statement
equation2 = else if statement
equation3 = else if statement
equation4 = else statement
Remember that there are buttons (at survey/group/question level) to check your EM syntax
For more complex equations, you can use some line break for more readability
Code:
{ if (A1 == 1, equation1, if (A1 == 2, equation2, if (A1 == 3, equation3, equation4))) }
Benoît
EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
Last edit: 7 years 6 months ago by Ben_V.
The topic has been locked.
- tpartner
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 10109
- Thank you received: 3593
7 years 6 months ago - 7 years 6 months ago #143476
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 Redirect to one of two different end URLs
Yes, Expression Manager uses the Excel format for IF() statements:
Code:
if(condition, 'Returned if true', 'Returned if false (can be another IF() statement)')
Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 7 years 6 months ago by tpartner.
The topic has been locked.
- JaredStapleton
- Offline
- New Member
Less
More
- Posts: 1
- Thank you received: 0
7 years 3 weeks ago - 7 years 3 weeks ago #151914
by JaredStapleton
Replied by JaredStapleton on topic Redirect to one of two different end URLs
For any other beginners who stumble here- don't forget the "redirect automatically" setting under Presentation and Navigation, and for me I had to activate the survey before the redirection would work. Otherwise you just see the url on the end page as a link.
Last edit: 7 years 3 weeks ago by JaredStapleton.
The topic has been locked.
- surveySn
- Offline
- Premium Member
Less
More
- Posts: 136
- Thank you received: 4
5 years 5 months ago #176261
by surveySn
Replied by surveySn on topic Redirect to one of two different end URLs
Hi tpartner,I have tried many times, but failed, can you make a LSS?
Thanks very much.
Thanks very much.
The topic has been locked.