Survey Router
Summary | This article shows how to route a respondent from a main survey to two follow-up surveys out of a possible six depending on their initial selection and remaining SQL quotas. The seven surveys are set up such that the respondent will always be taken back to the correct position in any of their surveys if they close the browser and then click on the original link again. |
to | AskiaDesign |
Written for | Survey programmers, Scripters |
Keywords | Label, Redirection, Broker, BrokerPaneId, Parameters, Web Template, Url, SQL, Quota, QuotaToDo, DoExternalPanel, Link |
Download the example QEX files in the links below:
The link to test the live example is below. You just need a new numeric BrokerPanelId for each new test.
https://show.askia.com/Webprod54/cgi-bin/askiaext.dll?Action=DoExternalPanel&SurveyName=_SA_SurveyRouterT0&Broker=BROKER&BrokerPanelId=9999999
In Supervisor, the surveys are set up as shown:
The SQL quotas are shown below along with the relation of each row in the quota table to each survey.
For the purpose of this article the quotas are simply measuring completes but SQL gives you the flexibility to extend this to a more involved quota set-up.
The main survey (T0) structure is shown below on the left. On the right you have the structure for the other six surveys:
In the main survey, the respondent picks Type 1, Type 2 or both at the types variable and this determines whether they are eligible for the T1, T2 or all six follow-up surveys respectively.
At the strSQLselection variable there is an ODBC import which determines which two follow-up surveys the respondent will get within their eligible selection:
SELECT TOP (2) QuestionCode FROM SRLeastFill WHERE (Type IN ('!!??types??[1]!!', '!!??types??[2]!!')) ORDER BY QuotaToDo DESC
This imported array is then used to set values into the loop arrselection. Links are generated in the nextlinks variable using routing:
All surveys contain qtdLoop and qtd variables. These are used to display quotas on the first page of each survey the respondent takes part in.
There is also a sPos (survey position) variable in each survey. In the main survey this is always 1. In the first of the two follow-up surveys it's 2 and in the last survey it is 3. This is used as a flag to instruct some behaviour in the follow-up surveys e.g. if you are in your 3rd survey (sPos=3) you will be directed in your final landing page, in this case, https://askia.com/ at the end rather than the generated link for your next survey.
Despite the fact a respondent takes part in 3 surveys, they are only ever sent one link. It is important to make sure that link can be reused to always take the respondent back to the last point they were at in any of the three surveys. This is managed is by always generating DoExternalPanel inks. These remember your position in a single survey. However, if you have completed the first survey then you will be take to its 'Already completed' page: Options > Internet options > Final pages > Already completed. So the trick here is to add the next link to the 'Already completed' section as well as the 'Final page' section in order to chain your completed surveys together.
Of course, a respondent can complete a main section and then two out of six follow-up sections in a single survey. With the survey router method, however, they can be routed in from and out to any survey with great flexibility. They don't have to come from one specific 'main survey', they can come from one of several 'main surveys' whenever the correct conditions are met. This can save on sampling effort.
Furthermore, the follow-up surveys can be such that they are directly accessed without the need to take a main survey first. It's harder to send a link to a respondent to enter the middle of a single, longer survey, in case you have that requirement.