In order to use imported data to apply weights to a survey, a virtual question must be created to match the imported data to the data in the new survey.
Step 1: Import Data
The first step is to import the data to your Builder survey. Click on the "actions" menu and select "import data". Then follow the steps outlined in the Importing Data document. Be sure to make note of the "key variables" you select during this process, as this will be used in a later step. The key variables are used to match the imported data to the data in the current project. Also include any fields that will be used to create the hidden question.
Tip: If you plan to use a unique identifier from a sample source as a key variable, set up the sample sources before you import the data file.
In our example below, our key variables are UID and UID, and the question we are going to use for the hidden question is included (i.e., the gender question).
Once the changes have been applied you will return to Builder's stage where the imported data will appear as the first question.
Step 2: Add the Virtual Question
Back in Builder's stage, add a new single-select element and add a row for each value in the hidden question. The values should match those in the corresponding question from the imported data.
In the general options for the question, add a "v" to the question label to indicate that it's a virtual question.
The labels for the answer options must match those used in the question from the imported data. To update them, click on the first answer option so the options appear in right side of Builder's stage. Edit the label in the "label" field. Do this for each answer option.
- If the source question from the imported data is a number question, change the labels of the rows to match the values in the source question. For example if male = 1 then the row with text male should have the label 1. (this can be changed in the options)
- If the source question from the imported data is a text question, the row text should match the possible value.
Step 3: Copy
Next, copy the label of the source question from the imported data, in our case "data_txt_gender". This can be found in the question tree.
Step 4: Edit XML
In the "actions" menu, select "open xml editor". (Click here for more information about the XML editor.) Locate the virtual question in the XML.
If the question in the imported data is a number question, enter:
<virtual> bucketize(hiddenQuestionLabel) </virtual>
If the question in the imported data is a text question, enter:
<virtual> textSearch(hiddenQuestionLabel) </virtual>
Where the highlighted portion is the label for the source question from the imported data, copied in step 3.
Note: When the changes to the XML are saved and you return to Builder's stage, the virtual question will no longer appear in the question tree. However, it can still be viewed by opening the XML editor or running a report.
Step 5: Weight Data
Follow the steps outlined in the Adding Data Weighting document, utilizing the labels from the virtual question for the weighting.
Note: Each field in the datasource is treated a new question, so if weights are being applied to each field then a virtual question must be created for each field.