Survey Help Documents

Survey Help Documents

Sql based answer types tips

Sql based answer types tips

 
Sql based query answer types are another powerful feature of NSurvey. 
 
Using Sql based type you can expose and use existing data directly in your survey. 
At this time the data will be exposed as a dropdown list, you can choose if you want to have it mandatory or not. By default there arent any out of the box Sql based answer types as these are related to your own database.
 
If you whish to create your own Sql type you will need to : 
 
Go to the form builder / answer type editor section. 
Click on create new type 
Give it a new eg : Customer list 
Select Sql query as a datasource 
Enter your Sql query eg: select customerid, customername from tbcustomers
Only Sql "select" based queries are allowed. 
If it requires a selection check the "selection required" box. 
Create type.
You can now use this new answer type in any new or existing question. 
 
Answer Piping
You can pipe answers from previous pages using the standard [[pipealias]]] tags directly in your Sql query, so in our previous example we could have for example a form that ask the user on the first page for his country and we could then retrieve through piping on the other pages the list of customers of the selected country. 
 
eg : select customerid, customername from tbcustomer where country = [[countryalias]]
 
Its also possible to use other piping tags like : 
##yourquerystringvariablename##
@@yoursessionvariablename@@
&&yourcookievariablename&&
%%servervariablename%%

Previous   BackToCategory   Next  4 of 9