Datapoints
getAllDatapoints()
Argument | Required | Description |
Returns |
Returns a list of all the Question, Hidden Variables, and Input Variables in the chat whether they are responded to or not. |
Following set of information inside each Question object would be present in the returned list:
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"
Example
local allQuestions = getAllDatapoints()
totalQuestions = size(allQuestions) - 1
for i =0, totalQuestions
do
log(allQuestions[i].Text) -- prints texts for all questions e.g. Tell us about your most amazing vacation! ✈️
log(allQuestions[i].Label) -- prints Labels e.g. Single_Choice_1, Multiple_Choice_1,
-- Open_Ended_Text_1, Open_Ended_Number_1
end
getDatapointByLabel(label)
aka gDBL(label)
Also available with an alias gDBL
Argument | Required | Description |
| ✔️ | Name of the label for the question |
Returns |
All the relevant info related to the Question as an object for which the Label is being passed. If the question does not exist with the label passed, it will return null. |
getMultiChoiceResponseCodes(questionLabel)
aka gMRCs(questionLabel)
Also available with an alias gMRCs
Argument | Required | Description |
| ✔️ | Name of the label for the question |
Returns |
Returns the response codes for Mulitple Choices Questions as an array |
E.g. Imagine a user responded Multiple_Choice_1 Question with answer as Thailand, Syechelles, Maldives, Bora Bora, India and Sri Lanka.
log(gMRCs("Multiple_Choice_1")) => Array of codes i.e. {1, 3, 4, 5, 7, 8}
getEngagementStartDate()
Engagement Start Date of the chat can be accessed by the function getEngagementStartDate
Argument | Required | Description |
|
|
|
Returns |
The engagement start date and time in the UTC timezone and format |
Example
getEngagementStartDate() -- returns: 2024-01-16T23:10:38.880
Profile Attributes
assignProfileAttribute(label, value)
A chat author may choose to assign profile attributes within their assignment card script. If so, they can use the AssignProfileAttribute(x, y)
function. A user can not assign to a system attribute.
Argument | Required | Description |
| ✔️ | should be the case-sensitive label of the profile attribute that exists within the research domain. If not, the function call will not update anything. |
| ✔️ | should be the appropriate value(s) depending on the type of profile attribute |
The following holds true about assigning value
to attribute of specified label
:
String attributes can have any string assigned.
Numeric attributes must conform to the format settings applied to the attribute, and be a valid number.
Choice attributes must be assigned the codes that exist on the choice attribute. In the case of a single-choice attribute, if multiple choice codes are provided as argument y, only the first will be used to determine assignment eligibility.
If the requirements specified above are not met, or generally wrong/incorrect arguments are supplied to the function, it will be skipped.
Returns |
|
getProfileAttribute(label)
A chat author may choose to get profile attributes for the participant within their assignment card script. If so, they can use the GetProfileAttribute(x) function.
Argument | Required | Description |
| ✔️ | should be the case-sensitive label of the profile attribute that exists within the research domain. If the profile attribute does not get resolved, either by improper naming or not existing for the participant profile, the values will not be as expected (undefined). |
Returns |
|