Looking Up and Replacing Values to Pipe into Fields


A client has provided a list that has codes for different types of product.  I’d like to customise the questionnaire to show what product they use and not the short hand code.  Currently these codes are saved in the customer file, in the future they maybe included as a URL variable.  For example, ‘TA’ is a code and we want to show ‘Transaction Account’ in the survey.

Jim W (Moderator) answered


    The customer file is the Contact List.  The variable is on the contact list.

    What I tried to do was:  Create an action with a Hidden Value using the Contact Variable and then create a hidden question that is populated with the Hidden Value.  Then having the value used as a merge code.  It didn’t work.  

    Because the variable is a code I need to change the code to what it represents when showing it to customers.  At the analysis stage the product code is used, however, at this stage in the survey it is just used to let the customer know which product we are asking them about.

    Hope this makes it clearer.


    seanmcnally380846 answered

      When we need to insert a value from the contact list, we create a hidden question (https://help.surveygizmo.com/help/hide-question-by-default) and insert the merge code for the contact value as the default answer (https://help.surveygizmo.com/help/preselect-answer-option#using-contact-data-as-default-answer-text).  Then when the respondent hits the NEXT button the contact value becomes a response that can be piped into following questions.

      It is also possible to write a custom code to replace a coded value with something else by using the  sgapiGetValue and sgapiSetValue functions.  The following pseudocode outlines that process:

      if sgapiSetValue(xx)==’TA’
           {sgapiSetValue(xx, ‘Transaction Account’);}

      Does this help?

      Jim W (Moderator) edited answer

        Hi Sean,

        Can you provide more detail on exactly how you want to customize your questionnaire?  What do you mean by the term ‘customer file’ – is this the contact list of an email campaign?

        Depending on what you are trying to achieve, you could probably use logic statements or custom scripting to get the results you want, but it is hard to say without knowing more details.

        Jim W (Moderator) answered


          Question stats

          • Active
          • Views11507 times
          • Answers3 answers
          • Followers1 follower