Skip to content

Action commands

Action commands let you automate responses based on what respondents have already told you—or based on system variables and conditions you specify. Think of them as your survey’s autopilot: they work behind the scenes to capture data without asking respondents to lift a finger. These questions are typically hidden from view in live surveys.

You’ll know a question has an Action Command attached when you see a yellow scroll symbol next to it in the flowchart (Survey Editor (Legacy)), or an amber bolt icon on its card (Survey Editor (Beta)).


Action Commands work with Single, Multi, Verbatim, Verbatims, and Grid question types. The commands available to you depend on which question type you’re working with—here’s the full lineup:

CommandDescription
COMBINECombines the answers of two or more identical questions into a single question
CONCATENATEConcatenates the answers from two or more questions into a single string
DATEDIFFCalculates the amount of time lapsed between two date questions
DATEPARTEnables the automatic capture of specific information based on a date variable
GETInserts the value of another single response or verbatim variable into a new question
MATHSHandles basic mathematical operations within a question
QUERYQueries an external database using SQL-style syntax
QUERYAPIConnects to and queries an external API to insert a response
QUERYDSQueries a datastore in the same subaccount as the survey
RANDOMEnters a value at random based on specified minimum and maximum values
RECODEEnters values based on specified rules
SETEnters specified values into the question, without conditions
TRANSLATETranslates a variable value into a specified language

In Survey Editor (Beta), the Command Type list only shows the commands that work on the selected question type:

Question typeCommands offered in Survey Editor (Beta)
Single, Verbatim, VerbatimsDATEDIFF, DATEPART, MATHS, QUERY, QUERYAPI, QUERYDS, GET, RANDOM, RECODE, SET, COMBINE, CONCATENATE, TRANSLATE
MultiRECODE, SET, COMBINE
GridCOMBINE, RECODE

Ready to add an Action Command? Here’s how:

  1. Add a Single, Multi, Verbatim, or Verbatims question to your survey flowchart
  2. Open the question’s menu
  3. Select Action Command
  4. In the Action Command dialogue box, select your Command Type
  5. Enter the action command syntax in the box. Remember to preface all question references with an @ symbol (e.g., @Q1). If you need multiple commands, place each one on a separate line with a comma at the end.
  6. Click OK

To test your action command, preview the survey and verify it’s working as intended. Once you’re satisfied, check the Hide property so respondents won’t see the question.


To remove an Action Command:

  1. Open the question’s menu
  2. Select Action Command
  3. Delete the action command syntax
  4. Click OK

The scroll symbol should no longer appear next to the object in the flowchart.


The COMBINE Action Command merges answers from two or more identical questions into a single question. Here’s a real-world example: imagine you’ve created two versions of the same question—one optimized for mobile, another for desktop. You can filter each by browser type, then use COMBINE to bring those answers together in a third (unfiltered) question.

The source and target variables must be identical in terms of question type and answer codes (though the question format and text can differ). Also important: source questions must be mutually exclusive—meaning any single respondent should only have answered one of them.

COMBINE Action Commands can be applied to Single, Multi, Verbatim, Verbatims, and Grid questions.

To set up a question to combine the answers to two or more questions:

  1. Add a Grid Multi question to the survey flowchart, and enter the answers into the Quick Update Box. Alternatively, duplicate one of the source questions, making sure to edit question filters as required. The answer codes in all questions must match, but the answer labels do not need to be the same.
  2. Open the question’s menu
  3. Select Action Command
  4. In the Action Command dialogue box, select COMBINE in Command Type
  5. Enter the variables to be combined, prefaced with an @
  6. Click OK

The CONCATENATE Action Command joins answers from two or more questions into a single text string. Think of it as stitching together multiple responses into one cohesive piece of data.

CONCATENATE Action Commands can be applied to Single, Verbatim, and Verbatims questions.

  1. Add a question to your survey flowchart and enter the answers in the Quick Update Box (if applicable)
  2. Open the question’s menu
  3. Select Action Command
  4. In the Action Command dialogue box, select CONCATENATE in Command Type
  5. Enter the variables to be concatenated, prefaced with an @ and separated by | (pipe)
  6. Click OK
Target VariableConcatenateExplanation
Verbatim@Q1|@Q2Inserts a text string concatenating the answers to Q1 and Q2, with no space between each
Verbatim@Q1 |@Q2Inserts a text string concatenating the answers to Q1 and Q2, with a space between each

The DATEDIFF Action Command calculates the time elapsed between two date questions. Whether you need to know how many days passed between a shop visit and the survey completion, or the hours between two events, this command does the math for you.

DATEDIFF Action Commands can be applied to Single, Verbatim, and Verbatims questions.

  1. Add a question to your survey flowchart and enter the answers in the Quick Update Box (if applicable)
  2. Open the question’s menu
  3. Select Action Command
  4. In the Action Command dialogue box, select DATEDIFF in Command Type
  5. Enter the Datepart (the unit of measurement), followed by the questions containing the beginning and end dates (prefaced with an @)
  6. Click OK

DATEDIFF: {DATEPART},@STARTDATE,@ENDDATE

The result is the first date minus the second, so it’s negative when the first date is earlier. A date without a time counts from midnight.

Target VariableDatediffExplanation
VerbatimDAY, @SurveyEntryStartDateTime, @ShopDateInserts the number of lapsed days between the ShopDate and the time at which the respondent completed the survey
VerbatimHOUR, @SurveyEntryStartDateTime, @ShopDateInserts the number of lapsed hours between the ShopDate and the time at which the respondent completed the survey
DatepartDescription
MILLISECONDNumber of milliseconds elapsed
SECONDNumber of seconds elapsed
MINUTENumber of minutes elapsed
HOURNumber of hours elapsed
DAYNumber of days elapsed
WEEKNumber of weeks elapsed
DAYOFYEARGives the same result as DAY
MONTHNumber of months elapsed
QUARTERNumber of quarters elapsed. The result has the wrong sign, so use MONTH instead.
YEARNumber of years elapsed

The DATEPART Action Command automatically captures specific information from a date variable. The date might come directly from the survey (like a respondent’s date of birth) or from a system variable (like SurveyEntryStartDateTime, which records when the survey began).

DATEPART Action Commands can be applied to Single, Verbatim, and Verbatims questions.

  1. Add a question to your survey flowchart and enter the answers in the Quick Update Box (if applicable)
  2. Open the question’s menu
  3. Select Action Command
  4. In the Action Command dialogue box, select DATEPART in Command Type
  5. Enter the Datepart (the unit of measurement), followed by the question containing the date (prefaced with an @)
  6. Click OK
Target VariableDatepartExplanation
VerbatimMONTHNAME,@SurveyEntryStartDateTimeInputs the name of the month from the survey start date

The following datepart options are available. Example results are based on @SurveyEntryStartDateTime = Dec 11 2021 1:28PM.

CommandExample ResultExplanation
AGE,@DOB43Respondent was 43 years of age at the time of the survey
WEEKDAY,@SurveyEntryStartDateTimeSaturdaySurvey was started on a Saturday
DAY,@SurveyEntryStartDateTime11Survey was started on the 11th
MONTH,@SurveyEntryStartDateTime12Survey was started on the 12th month
MONTHNAME,@SurveyEntryStartDateTimeDecemberSurvey was started in December
MONTHNAME_SHORT,@SurveyEntryStartDateTimeDecSurvey was started in December
YEAR,@SurveyEntryStartDateTime2021Survey was started in 2021
YEAR_SHORT,@SurveyEntryStartDateTime21Survey was started in 2021
TIMEOFDAY,@SurveyEntryStartDateTimeafternoonSurvey was started after midday, and before 6pm
TIMEOFDAY_FULL,@SurveyEntryStartDateTimeafternoonReturns the full time-of-day label
HOUR,@SurveyEntryStartDateTime01Survey was started after 1 o’clock (and before 2)
HOUR24,@SurveyEntryStartDateTime13Survey was started after 1pm (and before 2pm)

The GET Action Command pulls the value from another variable and inserts it into a new question. It’s perfect for capturing system data or referencing earlier responses.

GET Action Commands can be applied to Single, Verbatim, and Verbatims questions.

  1. Add a question to your survey flowchart and enter the answers in the Quick Update Box (if applicable)
  2. Open the question’s menu
  3. Select Action Command
  4. In the Action Command dialogue box, select GET in Command Type
  5. Enter the variable to be inserted, prefaced with an @
  6. Click OK
Target VariableGetExplanation
Verbatim@CurrentDateInserts a time stamp into the question
Single@LoopDriver1_CurrentAnswerInserts the code selected in the current loop iteration
Single@LoopDriver1_CurrentInserts the loop iteration
Verbatim@URLInserts the Survey URL into the question

The MATHS Action Command handles basic mathematical operations within a question. Keep in mind it’s limited to 2 variables max—if you need to calculate with more, the RECODE Action Command is your better option.

MATHS Action Commands can be applied to Single, Verbatim, and Verbatims questions.

To set up a Maths Action Command:

  1. Add a question to the survey flowchart, and enter the answers into the Quick Update Box where appropriate
  2. Open the question’s menu
  3. Select Action Command
  4. In the Action Command dialogue box, select MATHS in Command Type
  5. Enter the desired command (see examples below)
  6. Click OK

MATHS: {OPERATION},{value},@VariableName

This stores the result of @VariableName OPERATION {value}. Either can be a number or a question. Include all three parts: without the question, nothing is stored.

OperationWhat it does
ADDAdds the value to the question’s answer. With a date, adds that many seconds.
SUBTRACTSubtracts the value. With a date, subtracts that many seconds.
MULTIPLYMultiplies by the value
DIVISIONDivides by the value
MODULUSThe remainder after dividing by the value

Any other operation is treated as ADD. If both parts are dates with times, the result is the number of seconds between them.

Target VariableMathsExplanation
Single - numericDivision,100,@Q3Divides the response given to Q3 by 100
Single - numericSUBTRACT,5,@Q1Subtracts 5 from the response given to Q1

The QUERY Action Command connects to and queries an external database using SQL-style syntax. Survey question codes can be referenced in the WHERE clause to filter results based on respondent answers.

QUERY Action Commands can be applied to Single, Verbatim, and Verbatims questions.

SELECT {RESULT} FROM {TABLE} WHERE FIELD=@FIELD

ParameterDescription
{RESULT}The column or value to return from the database
{TABLE}The table to query
FIELD=@FIELDFilter condition — @FIELD is a survey question code whose value is used in the query

The QUERYAPI Action Command calls an external GET API and inserts the response into the question. The URL can include survey field code values, letting you pass respondent answers as parameters.

QUERYAPI Action Commands can be applied to Single, Verbatim, and Verbatims questions.

QUERYAPI: {URL}

ParameterDescription
{URL}A full URL to a GET API endpoint. Can include survey field code values (e.g., https://api.example.com/lookup?id=@StoreCode)

The QUERYDS Action Command queries a datastore within the same subaccount as the survey and returns the first row that matches the filter criteria. It’s useful for looking up reference data — such as store details, location information, or any other data held in a datastore — based on a respondent’s answer.

QUERYDS Action Commands can be applied to Single, Verbatim, and Verbatims questions.

QUERYDS: {DataStoreGUID},{ColumnName},{Filter}

ParameterDescription
{DataStoreGUID}The GUID of the target datastore. Must be in the same subaccount as the survey.
{ColumnName}The name of the column in the datastore to return
{Filter}A filter expression to identify the row to return. Reference survey question codes with @. The first matching row is returned.
Target VariableQUERYDSExplanation
Verbatimabc123-guid,StoreName,storeid=@storeidLooks up the StoreName column in the datastore where storeid matches the respondent’s @storeid answer
Verbatimabc123-guid,Region,postcode=@Q1Returns the Region value from the datastore where postcode matches the answer to Q1

The RANDOM Action Command generates a random value within the minimum and maximum range you specify. Perfect for randomization tasks or when you need to assign random values.

RANDOM Action Commands can be applied to Single, Verbatim, and Verbatims questions.

To set up a Random Action Command:

  1. Add a question to the survey flowchart, and enter the answers into the Quick Update Box where appropriate
  2. Open the question’s menu
  3. Select Action Command
  4. In the Action Command dialogue box, select RANDOM in Command Type
  5. Enter the minimum and maximum values
  6. Click OK

RANDOM: {MIN},{MAX}

ParameterDescription
{MIN}Minimum value (can be a literal number or a survey variable prefaced with @)
{MAX}Maximum value (can be a literal number or a survey variable prefaced with @)

RANDOM stores a whole number from MIN to MAX, including MIN and MAX.

Target VariableRandomExplanation
Single1,5Randomly selects one integer answer code between 1 and 5
Single - numeric7500,12500Randomly selects an integer between 7500 and 12500

The RECODE Action Command automatically enters values based on rules you specify. These rules can reference a previous survey question, a global survey variable, or be unconditional—you’ve got flexibility here.

RECODE Action Commands can be applied to Single, Multi, Verbatim, Verbatims, and Grid questions.

To set up a Recode:

  1. Depending on the data structure required for the recoded variable (the target question), add a Single, Multi, Verbatim, or Verbatims question to the survey flowchart and enter the answers into the Quick Update Box where required

    Data Structure RequiredSingleMultiVerbatimVerbatims
    Text/string?--YY
    Numeric?Y--Y
    Coded data?YY--
    More than 1 possible answer?-Y-Y
  2. Open the question’s menu

  3. Select Action Command

  4. In the Action Command dialogue box, select RECODE in Command Type

  5. Enter the action command syntax in the box, using the syntax examples below as your guide. Remember to preface all question references with an @ symbol (e.g., @Q1). If you need multiple commands, place each one on a separate line with a comma at the end.

  6. Click OK

Recode rules use Boolean logic. You’ll specify the clause as the value of the source question—when that’s true, it recodes to your specified value. You can also define what happens when the clause is false. If you don’t specify an “else” value, the recode will result in nulls for cases where the clause isn’t true. Separate multiple clauses with commas.

The syntax you need depends on two things:

  1. The question type of the variable that the recode rules will be based on (the source question)
  2. The data structure required for the recoded variable (the target question)
Source Variable/sTarget VariableRecode
Single (Q1)SingleWHEN @Q1=1 THEN 4 END, WHEN @Q1=2 THEN 5 END,
Single (Q1)MultiWHEN @Q1=1 THEN 4|1 ELSE 4|0 END, WHEN @Q1=2 THEN 5|1 ELSE 5|0 END,
Multi (Q1)MultiWHEN @Q1_1=1 THEN 4|1 ELSE 4|0 END, WHEN @Q1_2=1 THEN 5|1 ELSE 5|0 END,
Single (Q1)VerbatimWHEN @Q1=1 THEN 'Male' END, WHEN @Q1=2 THEN 'Female' END,
Multi (Q1)VerbatimWHEN @Q1_5=1 THEN 'Fifth answer selected in Q1' END,
Single - numeric (Q1)SingleWHEN @Q1<18 THEN 1 END, WHEN @Q1>=18 THEN 2 END,
Verbatim - text (Q1)SingleWHEN @Q1='Male' THEN 1 END, WHEN @Q1='Female' THEN 2 END,
Single Response Grid (Q1)VerbatimWHEN @Q1_1<5 THEN 'Less than 5 in first grid item' END,
Single (Q1 & Q1RANDOM)SingleWHEN @Q1=4 then @Q1RANDOM else @Q1 end,
VerbatimsVerbatimsWHEN @Q1_1 is not null THEN 1|@Q1_1 ELSE 1|'No answer' END, WHEN @Q1_2 is not null THEN 2|@Q1_2 ELSE 2|'No answer' END,
Source Variable/sTarget VariableRecode
Single (Q1), Single (Q2)SingleWHEN @Q1 = 1 AND (@Q2=1 OR @Q2=2) THEN 8 END
Single (Q1), Multi (Q2)SingleWHEN @Q1 = 1 AND (@Q2_1=1 OR @Q2_2=1) THEN 8 END
Source Variable/sTarget VariableRecode
Single - numeric (AGE)SingleWHEN @AGE>17 AND @AGE<25 THEN 2 END,
Single (NPS)SingleWHEN @Q5<7 THEN -100 END, WHEN @Q5=7 OR @Q5=8 THEN 0 END, WHEN @Q5>=9 THEN 100 END,

Creating an image reference for display in another question

Section titled “Creating an image reference for display in another question”
Source Variable/sTarget VariableRecode
SingleVerbatimWHEN @Animal=3 THEN 'tiger.png' END
Source Variable/sTarget VariableRecode
Single (Q1), Verbatim (ZooName)VerbatimWHEN @Q1=3 THEN 'Which animals did you see at ' + @ZooName + '?' END
Source Variable/sTarget VariableRecode
Multi (Q1)SingleWHEN @Q1_Count>1 THEN 1 ELSE 2 END

Calculating a total in a Multi Numeric question

Section titled “Calculating a total in a Multi Numeric question”
Source Variable/sTarget VariableRecode
Verbatims - numeric (Q1)Single - numericWHEN 1=1 THEN @Q1_total END
Verbatims - numeric (Q1)Single - numericWHEN 1=1 THEN (Number(@Q1_1) + Number(@Q1_2) + Number(@Q1_3)) END,

The SET Action Command enters specified values into a question without any conditions. It’s straightforward—you’re just setting a value, no logic required.

SET Action Commands can be applied to Single, Multi, Verbatim, and Verbatims questions.

To set up a Set Action Command:

  1. Depending on the data structure required for the recoded variable (the target question), add a Single, Multi, Verbatim, or Verbatims question to the survey flowchart and enter the answers into the Quick Update Box where required

    Data Structure RequiredSingleMultiVerbatimVerbatims
    Text/string?--YY
    Numeric?Y--Y
    Coded data?YY--
    More than 1 possible answer?-Y-Y
  2. Open the question’s menu

  3. Select Action Command

  4. In the Action Command dialogue box, select SET in Command Type

  5. Enter the variables to be set, prefaced with an @

  6. Click OK

Target VariableSetExplanation
Single - numeric0.25Inserts 0.25 into a numeric field
Single3Selects answer code 3
Multi1,1,1Selects the first three answer codes in a Multi question, based on sort order (if randomised, the first 3 codes in the randomised set will be selected). If there are more than three answers to the question, the remaining answers will contain null values.
Multi1,1,1,0,0,0Selects the first three answer codes in a Multi question, based on sort order (if randomised, the first 3 codes in the randomised set will be selected). The remaining three answers will be given a value of 0 to tag them as not selected.

The TRANSLATE Action Command translates the value of a survey variable into a specified language, identified by a supported ISO language code.

TRANSLATE Action Commands can be applied to Single, Verbatim, and Verbatims questions.

  1. Add a question to your survey flowchart and enter the answers in the Quick Update Box (if applicable)
  2. Open the question’s menu
  3. Select Action Command
  4. In the Action Command dialogue box, select TRANSLATE in Command Type
  5. Enter the variable to translate (prefaced with @) and the target ISO language code, without quotes
  6. Click OK

TRANSLATE: @VariableName,LanguageCode[,isEVE,translatePrompts,useGoogleTranslate,openAIContext]

ParameterDescription
@VariableNameThe survey variable whose value should be translated
LanguageCodeA supported ISO language code (e.g., en-au, fr, de). Don’t put it in quotes: a quoted code makes the translation fail.
isEVEOptional. true if the variable holds an EVE conversation. Default false.
translatePromptsOptional. For an EVE conversation, true also translates what EVE said. Default true.
useGoogleTranslateOptional. true uses Google Translate (the default). false uses OpenAI.
openAIContextOptional. When using OpenAI, a short description of what the text is about. It can’t contain a comma.

In Survey Editor (Beta), the TRANSLATE builder sets these with Variable, Language and More settings. A new command made in the builder uses OpenAI. TRANSLATE only runs on single-answer and text questions.

Target VariableTranslateExplanation
Verbatim@Q1,frTranslates the value of Q1 into French
Verbatim@OpenEnd,en-auTranslates the value of OpenEnd into Australian English