Skip to main content

Kinesis Support

All the topics, resources needed for Kinesis.

FocusVision Knowledge Base

Prepopulate Data

The data prepopulation feature lets you prepopulate (insert) data for each respondent. Kinesis Survey supports three means of prepopulating data:

  1. From CSV (Comma Separated Values) file
  2. From URL parameters
  3. From a value or condition (which is also referred to as a default answer)

1:  Prepopulating from a CSV File

To prepopulate from a CSV file, you must upload a list of respondents prior to prepopulating data from a CSV. See Respondent Management for further details. Your survey must be enabled to run either in invitation, verified invitation, or login mode. This setting can be adjusted from Survey Properties under the Survey Functions menu.

Your survey must indicate which questions are to be prepopulated. To mark a question as prepopulated, click on the question text in the survey editor. Then click on Advanced Settings. Here you can set "Prepopulate question?" to 'Yes.' You can also choose whether you want to display or hide this question by selecting 'Yes' or 'No' to "Display question to respondent?"


Once the above are satisfied, click the "Prepopulate data -> from CSV file" option under the "Survey functions" menu. All the questions that you have marked to be prepopulated in each question's properties will be listed in the Available Questions list. Pick questions in the order they appear in your CSV file and the system will automatically move questions to the Prepopulate Questions list.

1.1:  Select questions

The Available questions selection box displays all questions where "prepopulate from csv" has been selected under the questions advanced properties.

The Questions included in this report box displays all questions that you would like to prepopulate. To select a question, click on a question in the list under the Available questions, then click on the Add button. To unselect a question, click on a question in the list under the Questions included in this report, then click on the Remove button.

The order in which questions appear in the select box determines the order in which data must appear in your uploaded CSV datafile.

1.2:  The first value in the CSV data file

This determines what data field Kinesis Survey will look for as the first item in your CSV data file. This selection is required so that Kinesis Survey can link preloaded data to your respondents.

Your selection depends on which unique value you are using to identify your respondents. If you are running a web survey your unique value can be either email, unique identifier, or login. You may have all of three fields loaded into Kinesis Survey by using the Respondent Management. With wireless respondents that are uniquely authenticated by phone number, you would use phonenumber as unique identifier.

You will NOT be able to use the Prepopulate data feature with surveys running in Public mode because preloaded data needs to be linked to known respondents in the system. Therefore, the best way to accomplish this is to use Verified Invitation and preload your respondents from the Respondent Management. You must load respondents prior to preloading your prepopulation data or use the Create respondent if not found.

1.3:  Create respondent if not found

Selecting YES allows respondents to be created automatically during your CSV upload. The respondent will be created with a unique identifier matching the first value in the CSV file selection. If you are planning on sending invitations you must choose email as the first value in the datafile. If you are simply prepopulating data for respondents coming from other sources you will need to use identifier as first value.


Once you have selected the questions in the correct order and chosen from the First value in the CSV data file pulldown, click on Next step >>> button to be taken to the following page:

This page will provide you with the correct CSV column order that our system expects to successfully upload your CSV file. When the file is being uploaded, Kinesis Survey will verify each value is in a defined range and has a valid value. If any errors occur you will see a detailed explanation and any erroneous lines will be printed on the screen. All Radio and Checkbox data values are expected to be in the coded form, meaning that all data is numeric. Each number will equal the choice ID number of corresponding question. Alternatively, you can select the Use decoded values option for these question types. This will allow you to include the actual choice text in your CSV file. For quick reference, you can use the Print Survey feature to print out a copy of your survey. It acts as a code sheet that you can use for coding responses.

2:  Prepopulating from the URL

You can also pass data variables from one system to the next within the url. This method may be used, as an example, for passing along server-side data variables or information contained in third-party databases. To prepopulate from URL your survey must indicate which questions are to be prepopulated. To mark a question as prepopulated, click on the question text in the survey editor. Then click on Advanced Settings. Here you can set "Prepopulate question?" to 'Yes.' You can also choose whether you want to display or hide this question by selecting 'Yes' or 'No' to "Display question to respondent?"


Once the above are satisfied, click the "Prepopulate data -> from url" option under the "Survey functions" menu. All questions that you have marked to be prepopulated in each question's properties will be listed and will automatically be enabled unless you disable them. You have the option to force the parameter or not (meaning that a prepopulated field is required). Once these parameters have been adjusted according to your preferences, give the parameter a name. The parameter should have a short name as it will display in the url, and a shorter url is always desirable over a longer one. As parameters are passed into Kinesis Survey, the order of the parameters displayed in the url does not need to match the order of questions in the survey. The url display on the My Project Page will change accordingly to match programmed prepopulation from urls.

3:  Prepopulation from a Value or Condition

Questions can also be prepopulated with predetermined values or from prior responses or response sets. These are known as default answer conditions.

To establish a default answer based upon a value, simply check the third box under Default answer and enter the value to be prepopulated as shown below. Respondents would then only need to change the response for items where they were allocating a percentage.


When a Default Answer Value is entered, it must be logically sound (i.e., for a four-choice radio that default value has to be a number between 1 and 4). Default values for checkbox questions are entered in the format 1,2,3,4. Entry of 1,2,3,4 would automatically check choices 1,2,3, and 4 for all respondents. Default values for the date question type depends on the date format used. For example, if the date format is MM/DD/YY, you would set the default date by entering the default answer value 12,31,2006.

A default answer condition can be any conditional statement that returns values in the correct format. See below for accepted values and examples for each question type.

3.1:  Using user-created variables

User-created variables allow you to temporarily store a value within your logic. These are defined by using the syntax $USER_variable.

3.1.1:  Examples

$USER_select = 0;
$USER_name = "TEST";
$USER_array = array();

3.2:  Using If Statements

The "if" statement says "if this is true, do this, else do that". Its format is like this:

if ( condition )
{ do these instructions }
else
{ do these instructions }

3.2.1:  Example

if ($Q1==1)
{ return 1; }
else
{ return false; }

When adding multiple else conditions, use the "elseif" function. For example:

if ($Q1==1)
{ return 1; }
elseif ($Q1==2)
{ return 2; }
else
{ return false; }

3.3:  From a previous question

Previously stored questions can be referenced by using syntax $Qlabel.

3.3.1:  Examples

return $Q1;
return $Qid+100;

3.4:  Radio and Pulldown

Accepts a single number value corresponding to an available choice id.

3.4.1:  Examples

Return the first option:

return 1;

Check random choice ID between 1 and 5:

return rand(1,5);

3.5:  Text and Multiline Text

Accepts a string of text within quotations.

return "TEST";

3.6:  Number

Accepts any number value.

3.6.1:  Examples

return "123.45";

3.7:  Checkbox

Accepts an array of values to be checked.

3.7.1:  Examples

Check the first and fifth options:

return array(1,5);

Assuming that we have 3 questions (Q1,Q2,Q3), all simple yes/no radio questions. Now for each question that was answer yes, we will automatically check one choice in checkbox Q4. The condition is:

$USER_checkbox=array(); 

if ($Q1==1) array_push($USER_checkbox,1); 
if ($Q2==1) array_push($USER_checkbox,2); 
if ($Q3==1) array_push($USER_checkbox,3); 

return $USER_checkbox;

3.8:  Ranking

Accepts an array of choice IDs in the order of the desired ranking.

3.8.1:  Example

The second option is ranked first, the first option is ranked second and the third option is ranked third:

return array(2,1,3);

3.9:  Card sort

Accepts a multidimensional array, wherein the outside array index represents the category and the arrays within contain the cards selected for each category.

3.9.1:  Example

Sort cards 2 and 3 into the first category, card 1 into the second category and card 5 into the third category:

$USER_sort = array();

$USER_sort[1]=array(2,3);
$USER_sort[2]=array(1);
$USER_sort[3]=array(5);

return $USER_sort;

3.10:  Date

Accepts an array of values in order of year, month, and day.

3.10.1:  Example

Return Jan 1st, 2010:

return array(2010,01,01);

Returns current date. Note the date values are case sensitive when used with the date function - you must use lowercase d and m to prepopulate values, and the Y represents a 4-digit year while y represents a 2 digits year value. The example below will populate a date question with the MM/DD/YYYY format:

return (array( date('Y'), date('m'), date('d')));

3.11:  Slider

For single sliders, accepts a number value. For dual sliders accepts an array containing min and max values.

3.11.1:  Examples

return 50;

Set dual slider min value to -20 and max value to 50;

$USER_select = array();

$USER_select[0]=-20;
$USER_select[1]=50;

return $USER_select;

4:  Additional Resources

The methods and examples above only illustrate the basics for using default answer conditions. More complex logic and functions can be applied to perform advanced prepopulation.

5:  Commonly used default answer logic

5.1:  Auto-Punch Radio following a Checkbox

It is sometimes necessary to skip and auto-punch a radio question if a respondent only selects one response from a checkbox question. You can set the display of the radio question to "When default answer is not found" or condition it out so that it only skips if more than one choice is selected (array_sum($Q1)>1).

if (array_sum($Q1)==1) {

	return implode("",array_keys($Q1,1));
}

else return false;

5.2:  Return Top Rank Choice

It is sometimes helpful to reference an individual rank position. The following example is to be placed within a radio question with all possible rank choices as answer options. Change the number within the brackets, "[1]", to the rank position needing to be returned.

$USER_answer = "";

for ($USER_i=1; $USER_i<=count($Q1); $USER_i++) {

   if ($Q1[1]==$USER_i) $USER_answer = $USER_i;
   
}

if ($USER_answer!="") return $USER_answer;
else return false;

5.3:  Return count of items ranked

To be used if you need to find out exactly how many items were ranked for a ranking question. Ranking questions are stored as an indexed array containing all items. Items that were ranked will have the choice value in position it was ranked, and all other items will have a value of 0. For example, for a ranking with 10 options, if option 4 was ranked first, 5 second, and 6 third, with nothing else ranked, it would store as:

Array ( 
	[1] => 4 
	[2] => 5 
	[3] => 6 
	[4] => 0 
	[5] => 0 
	[6] => 0 
	[7] => 0 
	[8] => 0 
	[9] => 0 
	[10] => 0 
) 

Therefore, to get the amount ranked, you will need to return the total count of items minus the number of items that were not ranked.

return count($Q1)-count(array_keys($Q1,0));

5.4:  Return a random element

This logic can be used to randomly return 1 element. Be sure to include all elements needed in a comma-separated list within the parentheses in the logic below.

return rand(1,2);
  • Was this article helpful?