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
  • wshead's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 8 months ago #139057 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
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 8 months ago #139059 by tpartner
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:

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
  • wshead's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 8 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.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 8 months ago #139064 by holch
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.

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
  • wshead's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 8 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.
More
7 years 4 months ago - 7 years 4 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.
Last edit: 7 years 4 months ago by nique.
The topic has been locked.
More
7 years 4 months ago #143422 by Ben_V
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.
More
7 years 4 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!
The topic has been locked.
More
7 years 4 months ago - 7 years 4 months ago #143475 by Ben_V
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 4 months ago by Ben_V.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 4 months ago - 7 years 4 months ago #143476 by tpartner
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 4 months ago by tpartner.
The topic has been locked.
More
6 years 11 months ago - 6 years 11 months 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: 6 years 11 months ago by JaredStapleton.
The topic has been locked.
More
5 years 4 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.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose