The scripts in this document provide you with the ability to change the casing of your pipe so that is more suitable in the follow up question.
Without a script, the pipe text is shown exactly as it appears in the original question as illustrated below. Perhaps you would like to change the casing of the text so that it is grammatically correct or so that you can place more emphasis on the answer option your respondents have selected.
By using one of the scripts provided in this document, you are able to change the pipe text to lower, upper, or title case in the follow up question. Changing the case from title case (in the original question) to lower case in the follow up question is illustrated below.
Here’s an example of changing title case to upper case.
Here’s an example of changing from lower case to title case.
Detailed Steps
This procedure can be applied to any question type with appropriate modifications. You can change from one case to any other with the scripts provided in this document.
Add the original question and follow up question to your survey
- Go to the Questionnaire tab of your survey.
- Add your question containing the answer text to be piped. In this document, we will refer to this question as the original question.
- Add the question that will contain the piped text. In this document, we will refer to this question as the follow up question.
Prepare the script in Notepad
- Open Notepad or a similar text editing tool.
- Review the scripts below. Copy the script you would like to use into Notepad.
/*
Script Name: How do I manipulate text that is being piped? (Power Surveys)
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.
*/
Converts Pipe Text to Lower Case
This script converts the pipe text to lower case in the follow up question.
[%((String)QuestionName).ToLower()%]
Converts Pipe Text to Upper Case
This script converts the pipe text to upper case in the follow up question.
[%((String)QuestionName).ToUpper()%]
Converts Pipe Text to Title Case
This script converts the pipe text to title case in the follow up question.
[%System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(((string)QuestionName).ToLower())%]
- Edit the script in Notepad by replacing QuestionName with the name of your original question (i.e. the question that contains the answer text we are piping).
- For Title Case, in Notepad ensure the script is all on one line.
- Save the completed script in Notepad.
Note: The question names used in scripts are case-sensitive. Ensure that you use the exact question names as they appear in the Questionnaire tree of the study.
Insert the completed script into your follow up question
- Copy the completed script from Notepad.
- Select your follow up question in the Questionnaire Tree.
- In your question, place your cursor wherever it is you want your piped text to appear. An example is illustrated below.
- Paste the completed script from Notepad into your question. Your question should be similar to the illustration below.
- Click Save.
- Click Validate and test your survey.
Comments
0 comments
Article is closed for comments.