Over the weekend we noticed that someone had been searching the site for information about passing variables from the url of the survey into the survey itself. In this quick post we will show you how you can do just that.
Sometimes when we need to do this it is for passing the ID of a sample record into the survey so a certain participant can start their survey. When this is the case we use the &ID=XXXX command on the url so the full URL would be,
Other times we might just want to pass something in so that perhaps we can do something different in the survey based on the value of the item passed in. To help us do this we have nine parameters that we can use on the URL. They are ,
I.User1, ..... ,I.User9
we use them in the same way as the ID so &I.User1=A , but the key thing is what we do in the routing and the code we use for that is,
Routing(Web) Dim sValue sValue = iom.Info.User1 Select case sValue Case Is = "A" ' Do something Case Is = "B" ' Do something End Select End Routing
Another URL parameter that is a good one to know about it the I.RoutingContext one. If you have been writing surveys for a while now , you will understand that when you create one you create metadata , which holds all the information about the questions and then you also create a Web,Cati or perhaps Paper routing. In this section this is where you ask all your questions. You should also know that you don’t have to call the routings these pre-defined names, you can actually call them whatever you like and you can have as many as you like for example ,
Routing(WayA) Q1.ask() Q2.ask() Q3.ask() Q4.ask() End Routing Routing(WayB) Q4.ask() Q2.ask() Q3.ask() Q1.ask() End Routing
and with the I.RoutingContext you can get different people to take different routings by passing the parameter on the URL like this,
http://MyServer/mrIWeb/mrIWeb.dll?I.Project=MySurvey&I.RoutingContext=WayA Or http://MyServer/mrIWeb/mrIWeb.dll?I.Project=MySurvey&I.RoutingContext=WayB
So there you have it a quick post on how you can pass URL information into your survey.