Piping Text into Questions, Answers/Topics & Validation Rules

Overview

The following steps will introduce you to various usages of the ‘SetTextFormat’ methods which are very useful and commonly used in STG.

With the ‘SetTextFormat’ method’s you will be able to pipe text objects in different places in your survey, making it much more flexible and adjustable to the respondent’s answers.

For example, you can pipe the text of answers chosen, inside the surveys questions and answers you determine.

Please note: The text piped will be shown while the interview is conducted but will not be saved with the interview data.

Setting text objects inside a questions body.

  • Set up the following identifiers {x} for the amount of different text objects you wish to pipe.

    (each identifier will be replaced with the string you decide)

  • The following commands are being commonly used in order to do so:

    SetTextFormat (Of Which Question?, text for {0}, text for {1}, etc’)

    SetAnswerTextFormat( Which Question?, Which Answer?, text for {0}, text for{1}, etc’)

    SelectedAnswerText(Which Question?)

  • For Example, The following script will pipe the text of the selected answer from question 1 instead of {0} and text of the selected answer from question 2 instead of {1}.
    SetTextFormat
    (CurrQues,SelectedAnswerText(1),SelectedAnswerText(2));


Setting text objects inside a questions answer.

  • Let’s take for example the following basic MultiChoice question:

  • Let’s use the previous question’s answer in order to adjust the followings question’s answers!

  • The following script will take the text from question 4 answer and pipe it where we placed the identifiers.
    SetAnswerTextFormat(5,1,SelectedAnswerText(4));
    SetAnswerTextFormat(5,2,SelectedAnswerText(4));
  • Eventually it will look like this:

Of course you can use those methods in a vast variety of ways in order to make your survey flexible and adjustable.

To Learn how to pipe answers into a validation rule, click here.

Best Practices

“Text piping” is a common method used to dynamically pipe text into a question / answer / topic text during runtime. The piped text is for display only yet it is not saved as part of the survey data. If you’re piping some text that was randomly generated based on some logic and that text is not an existing marked variable in the script - you will need to save it to a variable if you need to know what was the piped in. For example if you have a question with 4 answers that have their text {0} and you pipe into those calculated values or randomly selected items etc. and your question asks for the favorite you will not be able to distinguish in the final data what text was piped to what answer option, unless you’ll save that information in some dummy question (for instance you can have a dummy open ended grid question with 4 topics, matching the 4 answers options, and auto-set each topic with the desired text value in the same order you pipe those texts into the answers options).

Was this article helpful?
4 out of 5 found this helpful
Have more questions? Submit a request

Comments

3 comments
  • using SetAnswerTextFormat I want to store value as answer of OpenEnded question.  

     

    0
    Comment actions Permalink
  • Hello, How to adapt SetAnswerTextFormat ( 5 , 1 , SelectedAnswerText ( 4 )) with an answer other to specify

    0
    Comment actions Permalink
  • Hello, you just add "true" after 4, to get other specify, should be like this :
    SetAnswerTextFormat ( 5 , 1 , SelectedAnswerText ( 4,true ))

    0
    Comment actions Permalink

Please sign in to leave a comment.