Currently questions and their responses can be accessed in the script by utilizing simple object notation.
Following set of information is accessible by the name of the question object:
Id: "String"
Type: "String"
Label: "String"
Text: "String" # if the question is not answered before it has been accessed, it would be null
IsSet: "Boolean" # `true` if the question is answered, `false` otherwise
Choices:
- Value: "String" # this would be Id of the choice
Label: "String"
Text: "String"
Statements: # For Single and MultiChoice Grid Questions, would be an array of objects
- Id: "String"
Label: "String"
Text: "String"
Choices:
- Value: "String"
Label: "String"
Text: "String"
Value: # For Single Choice it would be an object, for multiple choice it would be an array of object
- Text: "String"
Label: "String"
Code: "String"
Open Ended Text Question
openQ=gDBL("Open_Ended_Text_1")
openQ.Label -- returns Open_Ended_Text_1
openQ.Type -- returns OpenEndedTextCard
openQ.Text -- returns \U0001F334 Tell us about your most amazing vacation
openQ.IsSet -- returns true/false (true if response is provided, false otherwise)
openQ.Value -- returns Provided Reponse (e.g. Surfing with my pals on the Gold Coast, Australia)
Open Ended Numeric Question
Unlike other question types, the Value for this one would not be the image url or the image it self. Instead the value of Value would be true if the image is submitted by the respondent. If the question is not yet encountered or does not exist, it would be null which is the same behavior as other question types.
openI=gDBL("Open_Ended_Image_1")
openI.Label -- returns Open_Ended_Image_1
openI.Type -- returns OpenEndedImageCard
openI.Text -- returns Add your favorite pic with one of your favorite rides
openI.IsSet -- returns true/false (true if response is provided, false otherwise)
openI.Value -- return true as text if the image is submitted
Unlike other question types, the Value for this one would not be the video url or the video it self. Instead the value of Value would be true if the video is submitted by the respondent. If the question is not yet encountered or does not exist, it would be null which is the same behavior as other question types.
openV=gDBL("Open_Ended_Video_1")
openV.Label -- returns Open_Ended_Video_1
openV.Type -- returns OpenEndedVideoCard
openV.Text -- returns Add a video highlighting your experience with your favorite rides
openV.IsSet -- returns true/false (true if response is provided, false otherwise)
openV.Value -- return true as text if the video is submitted
Single Choice Question
SC=gDBL("Single_Choice_1")
SC.Type -- Returns: SingleChoiceCard
SC.Label -- Returns: Single_Choice_1
SC.Text -- Returns: \U0001F3D6️ How frequently do ya take a vacay? ✈️ Let us know!
SC.Value -- Returns One of the options selected by Participant as an object e.g. {Label: Once_every_six_months, Text: Once every six months}
SC.Value.Label -- Returns Once_every_six_months
SC.Value.Text -- Returns Once every six months
SC.Value.Code -- Returns 1
SC.IsSet -- Returns true/false (true if response is provided, false otherwise)
SC.Choices -- Returns: [{Label: "Once_every_six_months", Text: "One every six months"}],
{Label: "Once_a_year", Text: "Once a year"......}.
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 Question
MC = gDBL("Multiple_Choice_1")
MC.Type -- Returns: MultipleChoiceCard
MC.Label -- Returns: Fav_Color
MC.Text -- Returns: Fav Color
MC.Value -- Returns One or more of the options selected by Participant as an array of objects e.g. [{Text: "Thailand", Label: "Thailand"}, {Text: "Bora Bora", Label: "Bora_Bora"}]
MC.IsSet -- Returns true / false
-- Access Specific Response Text and Labels
MC.Value[0].Text -- Returns "Thailand"
MC.Value[0].Label -- Returns "Thailand"
MC.Value[0].Code -- Return 1
MC.Value[1].Text -- Returns "Bora Bora"
MC.Value[1].Label -- Returns "Bora_Bora"
MC.Value[1].Code -- Returns 2
MC.Choices -- Returns: [{Label: "Thailand", Text: "Thailand"},
{Label: "Seychelles", Text: "Seychelles"}....{Label: "Sri_lanka", Text: "Sri lanka"}]
MC.Choices[7].Label -- Returns: "Sri_lanka"
MC.Choices[7].Text -- Returns: "Sri lanka"
MC.Choices[7].Code -- Returns: 8
responseChoicesSize = size(MC.Value) - 1
-- Assume the customer responded with "Thailand and Seychelles"
for i = 0, responseChoicesSize
do
log(MC.Value[i].Text) - prints choice text in this case Thailand, Seychelles
log(MC.Value[i].Code) - prints choice code in this case 1, 3
log(MC.Value[i].Label) - prints choice Label in this case Thailand, Seychelles
end
You can access all responses for Multiple choice question using gMRCs() function. Check out details here
Single Choice Grid Question
SCG = gDBL('Rate_your_experience')
SCG.Type -- Returns: SingleChoideGridCard
SCG.Label -- Returns: Rate_your_experience
SCG.Text -- Returns: Rate your experience in all these adventure parks
SCG.IsSet -- Returns true / false
SCG.Statements -- Returns an array of objects corresponding to each of the statements
SCG.Statements[0].Text -- Park1
SCG.Statements[0].Label -- Rate_your_experience_1
-- Access Specific Response Text and Labels For Statements
-- Assuming customer responded with Great for Park1 and Blown Away for Park2
SCG.Statements[0].Value.Text -- Returns Great
SCG.Statements[0].Value.Code -- Returns 4
SCG.Statements[0].Value.Label -- Returns Great
SCG.Statements[1].Value.Text -- Returns Blown Away
SCG.Statements[1].Value.Code -- Returns 5
SCG.Statements[1].Value.Label -- Returns Blown_Away
SCG.Choices -- Returns an array/list of objects corresponding to each choice
SCG.Choices[1].Label -- Returns: Ok
SCG.Choices[1].Text -- Returns: Ok
SCG.Choices[1].Code -- Returns: 2
SCG.Statements[0].Choices -- Returns Returns an array/list of objects corresponding to each choice.
-- The choices would be same for all the statements and the grid question it self
Multiple Choice Grid Question
MCG = gDBL('Your_fav_rides')
MCG.Type -- Returns: MultipleChoiceGridCard
MCG.Label -- Returns: Your_fav_rides
MCG.Text -- Returns: What rides you love the most in below adventure parks? Select all that apply
MCG.IsSet -- Returns true / false
MCG.Statements -- Returns an array of objects corresponding to each of the statements
MCG.Statements[0].Text -- Park1
MCG.Statements[0].Label -- Your_fav_rides_1
-- Access Specific Response Text and Labels For Statements
MCG.Statements[0].Value -- Returns an array of objects consisting of all the selected options
-- Lets say Tornado and Free Fall are selected, then an array of size 2 will be returned --
MCG.Statements[0].Value[0].Text -- Returns Tornado
MCG.Statements[0].Value[0].Code -- Returns 3
MCG.Statements[0].Value[0].Label -- Returns Tornado
MCG.Statements[0].Value[1].Text -- Returns Free Fall
MCG.Statements[0].Value[1].Code -- Returns 4
MCG.Statements[0].Value[1].Label -- Returns Free_Fall
MCG.Choices -- Returns an array/list of objects corresponding to each choice
MCG.Choices[1].Label -- Returns Red_Baron
MCG.Choices[1].Text -- Returns: Red Baron
MCG.Choices[1].Code -- Returns: 2
MCG.Statements[0].Choices -- Returns an array/list of objects corresponding to each choice.
-- The choices would be same for all the statements and the grid question it self
Recontact Card
Unlike other types, this card/question-type has two data points
The default datapoint is Recontact's Status
recontact=gDBL("Recontact_91")
recontact.Label -- returns Recontact_91
recontact.Type -- returns RecontactCard
recontact.Text -- returns Can we follow up with notifications for future chats? Let's keep in touch!
recontact.IsSet -- returns true/false (true if response is provided, false otherwise)
recontact.Value -- return Status Code as Numeric Value (1 for Completed, 2 for Declined, 3 for Aborted, 4 for Pending)
If a suffix __RecontactMethod would be added to the Label, the Recontact Method's datapoint values would be returned
recontact=gDBL("Recontact_91__RecontactMethod")
recontact.Label -- returns Recontact_91__RecontactMethod
recontact.Type -- returns RecontactCard
recontact.Text -- returns Can we follow up with notifications for future chats? Let's keep in touch!
recontact.IsSet -- returns true/false (true if response is provided, false otherwise)
recontact.Value -- return Status Code as Numeric Value (1 for SMS, 2 for Email)