Skip to main content
All CollectionsScripting
Accessing Hidden and Input Variables

Accessing Hidden and Input Variables

Updated over 3 months ago

Hidden Variables

Hidden Variables and Input Variables have mostly the same property structure as questions, listed before. The difference is instead of Text prop to get the chat text for the element, it is Description.

Following set of information is accessible by the name of the question object:

HiddenVariable object

Id: "String"
Type: "String"
Description: "String"
Label: "String"
Value: "String"
IsSet: "Boolean" # `true` if the question is answered, `false` otherwise
Choices: # For choice-based Hidden Variables, Choices would be an array of objects)
- Value: "String" # this would be Id of the choice
Label: "String"
Text: "String"

Text type hidden variable

TextH=getDatapointByLabel("Text_hidden_var")
TextH.Label -- returns
TextH.Type -- returns
TextH.Value -- returns value for the participant

Numeric type hidden variable

NumH=getDatapointByLabel("Numeric_hidden_var")
NumH.Label -- returns
NumH.Type -- returns
NumH.Value -- returns value for the participant

Single choice hidden variable

SC=getDatapointByLabel("Single_choice_hidden_var")
SC.Type -- Returns:
SC.Label -- Returns:
SC.Value.Label -- Returns
SC.Value.Text -- Returns
SC.Value.Code -- Returns 1
local i = 0
SC.Choices[i].Label -- Returns: Once_every_six_months
SC.Choices[i].Text -- Returns: Once every six months
SC.Choices[i].Code -- Returns: 1

Multiple choice hidden variable

MC=getDatapointByLabel("Multiple_choice_hidden_var")
MC.Type -- Returns:
MC.Label -- Returns:
MC.Value[i].Label -- Returns
MC.Value[i].Text -- Returns
MC.Value[i].Code -- Returns 1
local i = 0
MC.Choices[i].Label -- Returns: Once_every_six_months
MC.Choices[i].Text -- Returns: Once every six months
MC.Choices[i].Code -- Returns: 1

Input Variables

Example

I=getDatapointByLabel("Input_var")
I.Value -- returns value for the participant
Did this answer your question?