Piping Text into Questions and Answers

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.

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?
3 out of 3 found this helpful
Have more questions? Submit a request

Comments

5 comments
  • Can you please SetAnswerTextFormat with an example again?

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

     

  • Hi Sher,

    Using an answer of an Open Ended question is done by using the function Answer(Qidx) so for example the text piping into an answer will be writen as SetAnswerTextFormat(QRef(2), 3, Answer(Qref(1)) where question index 1 is the Open Ended question and the piping is done to question 3.

    I recommend that you open support requests for such questions as our response to support tickets is much faster than to comments.

    Best Regards,

    Daniel

  • Using SetTopicTextFormat I want to store value as answer of Single Choice Grid question.  

  • I would like to know how to pipe answers from a Multiple Choice question.
    Ex:
    In a specific question Y, I need to pipe the first answer from question X, and in another question Z, I need to pipe the second answer from question X.

Please sign in to leave a comment.