I want to populate multiple demographic answer fields from a single answer


I have set up a question for a user to select from a list of options (stores). These stores in turn belong to a user  specific sub-region which in turn belongs to a specific region and a specific country.

I want the store selection to drive completion of some or all of these fields. Is this possible to do? If so what functionality do I use.






Jim W (Moderator) answered

    If I understand your request correctly, you want the selection of a store to automatically ‘answer’, or populate, two other questions – Region and Country.  You could write custom scripts to accomplish this.

    Your first step would be to create two text box questions – Region and Country – and then hide them from the respondent (https://help.surveygizmo.com/help/hide-question-by-default).

    You would the have to create a script (https://help.surveygizmo.com/help/scripting) to your survey.  The script itself would be simple – just a series of IF statements to read the value of the Store question.  In pseudo-code they would look something like this:

    %%xstore = sgapiGetValue(5); //5 is the ID number for your Store question
    IF %%xstore > 25 AND %%xstore < 49 // evaluate the store number
    sgapiSetValue(6,”Northwest”); // where 6 is the ID for your Region question
    sgapiSetValue(7, “Canada”); // where 7 is the ID for your Country question

    IF %%xstore > 50 AND %%xstore <99………..



    Jim W (Moderator) answered
      peter 106 Rep.

      Thanks for your answer although I am struggling to understand it a bit and would welcome a bit more of an example if that were possible (ie please!).

      I have set up a survey on my account called Peter Test . When they answer in Question 1 I want it to automatically fill in Questions 2 and 3.

      In this example: Store (Q1) the answer is, for example “157 Ayr” which is in “North West” sub-region(Q2) which in turn is in “North” region(Q3).

      Could you give me an example of what the syntax might be?


      peter answered

        Yes, you can do this with Question Merge Codes.  They will look something like this: 

        [question(“value”), id=”3″] or [question(“option value”), id=”2″] 

        You will need to replace 2 or 3 with the question ID you are trying to pull the answer from.  Here is an article with more details on how to do this: https://help.surveygizmo.com/help/merge-code-intro 

        Mary L (Moderator) answered


          Question stats

          • Active
          • Views264 times
          • Answers3 answers
          • Followers1 follower