Skip to main content

Assigning Value To Hidden Variables

Updated over 10 months ago

Here is a rule table on what type can be assigned to a hidden variable of a particular type

Hidden Variable Type

Return Type

Text

Text, Number

Numeric

Number

SingleChoice

An Array with single code

MultipleChoice

Array with relevant codes

Text type hidden variable​

Following are the valid scripts for this Assignment Card for text type card

-- Script 1 --
return "Hello World!"
-- Script 2 --
return 10
-- Script 3 --
myName = 'Cool Script Author'
return myName
-- Script 4 --
myAge = 30
return myAge

To return an empty string and pipe it, use a space " ". A string/text returned without a space "" would be treated as null in the piping logic resulting into skipping of the card in which the hidden variable values is supposed to be piped.

Numeric type hidden variable​

This is a card associated with Numeric type hidden variable. Following is a valid script for this Assignment Card.

myAge = 30
return myAge

Single choice hidden variable​

Return the choice code to assign the value to a single choice hidden variable.

--an array containing a code value is used to assign a single choice hidden variable
return {Single_choice_hidden_var.Choices[i].Code}
return {1}

Multiple choice hidden variable​

Return the choice codes to assign the value to a multiple choice hidden variable.

--an array containing code values is used to assign a single choice hidden variable
return {Multiple_choice_hidden_var.Choices[i].Code,Multiple_choice_hidden_var.Choices[j].code}
return {1,2}

Did this answer your question?