This script is intended to test if a participant has given every row in a Grid the same scale value answer. It would likely be used to then disqualify that participant since the quality of the data is suspect. This script should be used when "straight-lining" cannot make sense based on the row options.
Detailed Steps
Adding and setting up the questions
- Click on the Questionnaire tab of your survey.
- Create your Grid question.
- Create a Single Choice question to act as the straight-line flag. Make sure this question has one answer option only (the text should be something like Straightlined at GRID_NAME).
- Hide the Single Choice question by right-clicking on the question and selecting Hide.
- Click Save.
Prepare the script in Notepad
- Copy the script below into Notepad or a similar text editing tool.
- Change GRID_NAME to the name of your grid question.
- Change FLAG_Q to the name of your straight-line flag.
- Save the completed script in Notepad.
Script
/* Script Name: How do I test to see if a respondent has "straight-lined" a grid question ? To ensure your script works as expected, always copy the original script from the script library found in the support portal. Failure to use the most up to date script from the script library may cause unexpected results. */ ChoiceQuestion flag = FLAG_Q; int temp = 0; bool sline = true; Unset(flag, (int) flag); foreach(ShowQuestionAction sqa in GRID_NAME.WorkflowSteps) { ChoiceQuestion cq = (ChoiceQuestion)sqa.ChoiceQuestion; if(temp == 0)temp = (int)cq; else { if(temp != (int)cq) { sline = false; break; } } } if(sline) Set(flag, 1);
Insert the completed script into the Scripting section your question
- Select the Grid question in the Questionnaire Tree.
- In the Scripting section of your question, click Edit Scripts.
- Go to the OnExit tab.
- Copy and paste the script from the editor to the OnExit tab.
- Click Save and close the script editor.
- This hidden question can now be used to filter and/or disqualify participants.
Note: Multiple straight-lining flags can be set up per survey. Each flag question must have a unique name, and should reflect the name of the corresponding grid (e.g. for a grid named Q1, the flag name could be Q1_STRAIGHTLINE_FLAG).
More Information
Read this WebHelp article to learn more about Grids.
Comments
0 comments
Article is closed for comments.