Add a script to get or post profile variable values

You can add a script to your power survey to save new values to profile variables or retrieve existing values.

You use post scripts to save new values to a profile variable; you use get scripts to retrieve existing values for members.

  1. In Power Survey Authoring, click the Questionnaire tab.
  2. On the Authoring Navigation Bar, from the Action menu, select Script.
  3. Enter a name for the new script and click OK.
  4. Copy and paste the appropriate get or post script template into the script editor. The script templates for each profile variable type are listed and described in Use profile variables in a power survey.
  5. Add a question, with the same type as the question type defined in the script, to your power survey. For example, if you added a get script template for a single choice question, add a single choice question to your survey.

    If you are adding a single choice or multiple choice question, you must enter the exact values defined for the corresponding profile variable in the same order.

  6. If you are capturing the profile variable because you intend to use it in your power survey (for example, in a conditional sequence) select the Hidden checkbox to hide the question in the power survey by default.
  7. Open your script in the script editor and replace the placeholder values. If the script is a single line, enter the values as described in the Notes column for the script template in Use profile variables in a power survey. If the variables are defined in the first two lines of the script, update each line separately:
    • On the top line, replace the placeholder value after the equals sign with the name of your question.
    • On the second line, replace the placeholder value after the equals sign with the name of the profile variable you are associating the question with. The profile variable name must be quoted.
  8. Click Save.