Variable Names - Default vs Non-Default


Each question / topic / answer in a script, has its own unique variable name. That variable name is what represents it in the exported data set. The questions' variable names are also used in function calls to refer to the question rather than the index for example Answer(AgeQ) rather than Answer(QRef(3)) which leads to a more maintainable and clear script. Once those are created, a default variable name is generated by the system. You can then manually change the default variable name to something else and so make it a Non-default variable name.

In this article we will explain the differences between a DEFAULT variable name and a NON-DEFAULT variable name, along with the expected behavior of each.

Default variable names

The default variable name is automatically created by the system once the item (question / topic / answer) is created. A variable that is defined as default, will be displayed in green, as you can see in this example:

Question default variable name:

The default format of questions variable names is "Q_x", where "x" represents the question running index. So for example if you add a question and it is question index 10, the default variable name of that question would be "Q_10". 

Another fact about that default variable format "Q_x" is that it automatically changes when the question index changes. For example, if I had a question in index 10 and its default variable name was "Q_10", and I later added a new question before it and the original question that was index 10 is now shifted to index 11, its default variable name will automatically change to "Q_11". Click Here to learn how to keep variable names constant.

Topic / Answer default variable name:

The default format of Topics and Answers variable names is defined in the survey's Advanced tab:

What is shown above is the default settings that will show up once the script itself is created. As you can see the format is combined with several parts, and each one can be changed if needed. In the above screenshot, the default variable name format is "<Question variable name>_<Answer/Topic Coding>". When it comes to topics, the default variable name format will always start with the letter "T". As for answers, the default format will always start with the letter "A". So for example, this is a question with these default answers variable names, based on the default format shown in the above screenshot:


"A" - The default answer prefix

"Q_2" - the question's variable name

"x" (the last number in each variable name above): The code of the answer. 


For Topics / Answers variable names settings, you can change the default format defined, through those bars in the Advanced tab of the survey. For example, I can decide to have the default format like this:

So in this case, the default variable name of answers in the following question would be this:

"A" - The default answer prefix

"qu_002" - the question's short ID

"2" - the question's internal system ID

"x" (the last number in each variable name above): The index of the answer. 

NOTE: when changing the format settings and clicking "Apply", you'll get this message:

Choose "Yes" to have all the default variables names that already exist in the script, to follow the new default format you've set.

Non-Default variable names

While variable names are generated by default once the item is created, they can also be changed (manually) to something else, other than the default format defined. If you change a default variable name, the variable name will then be considered as "non-default", and will be displayed in blue:


It is recommended to rename the questions' variable names to be different than the default format as it make those stay constant and also makes those readable and with easy references when you export and analyze your data.

Same applies for topics / answers, where you can manually change those to anything you want:

Issues with the Default / Non-default names behavior:

It is not very common, but certain processes taken might lead to a scenario that would be problematic during scripting. The scenario is to have a variable name that is in a Default format, but is recognized as a Non-default variable. Or in other words, a variable that is displayed in blue while it should be displayed in green (as it is in default format). Let's look at this example:

The variable name of this question is "Q_2". Which means, it follows the default question variable name format. Yet, it is displayed in blue, meaning the system considers it as Non-default variable. As such, this variable name is NOT subject to change (as Non-default questions variable names stay constant). The problematic scenario would be this: If I'll add a new question to my script that will be added as question index 2, it will get the default variable name "Q_2":

The variable name of the original "Q_2" question (shown in "blue" previously above) stays the same, and so now we have a situation where we have two different questions with the same variable name of "Q_2":

This is an issue as each variable name in the script must be unique. Having this situation as above will cause problems moving between questions and prevent to save the script. It will usually through errors as such:

As mentioned, this situation is unique and usually can happen from two reasons:

1) Script was created in an older studio version that didn't yet support in the Default / Non-default variable names feature.

2) A variable name was manually changed to a format that matches the default one (and so ended up with a default format but is considered as Non-default as it was manually changed).

How to fix this:

Click on the search in Survey icon 

Click on Search and find the 2 questions that have the same variable name 

That’s it!

Visit us at:

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



Please sign in to leave a comment.