Introduction
Sometimes spontaneous awareness data is captured in a single text box with commas delimiting separate responses. Prior to using Displayr's coding variables it is necessary to split such data up into multiple variables.
Method
This is done as follows:
- Hover over any variable in the Data Sets tree and click the Plus (+) that appears when you hover over it.
- Select Custom Code > JavaScript - Text.
- In the JAVASCRIPT CODE field, type (myVar).split(',')[0], replacing myVar with the name of your variable. This will create a variable containing the first item (i.e., the text preceding the first comma).
- Fill in the Name and Label fields as appropriate.
- Right-click on the newly-created variable and select Duplicate in the toolbar.
- Right-click on the copy and go to the Object Inspector on the right.
- In the JAVASCRIPT CODE field, replace [0] with [1].
- Keep repeating the above three steps, increasing the number in the square brackets each time, until you have as many variables as are required.
- Select all the newly created variables, right-click and select Combine and set them as a Text - Multi.
You can then use the steps outlined in How to Manually Code Multiple Response Text Data to do the categorization.
In situations where the data is not so neat (e.g., people have used spaces to delimit, or have used 'and') it is still possible to split the variables up but the required JavaScript is more complicated and there is no one-size-fits-all solution.