Saltar al contendio prinicipal

Question Execution

Advertencia

Esta página aún no se encuentra traducida al español.

COTQuestionExec

Description

The Question Execution Data Model (COTQuestionExec) is part of COTQuestion within an exec field, i.e., exec.onChange, exec.onDisplay, exec.preload, exec.presave, exec.postsave, exec.validate. This model holds data for a Javascript-automated question that runs within a component lifecycle stage. It specifies the parameters or context variables and source code used in Javascript-automated survey components.

graph LR; S[COTSurvey] --> C1[COTSurveyChat #1] S --> C2[COTSurveyChat #2] C1 --> Q1T[COTQuestion - Field Label] C1 --> Q1I[COTQuestion - Input Settings] C2 --> Q2T[COTQuestion - Field Label] C2 --> Q2I[COTQuestion - Input Settings] Q2I --> QE[COTQuestionExec]

JSON Sample

{
"exec" : {
"validate" : {
"context" : "responses#self",
"src" : "function run() { const email = context['responses#self'][0] ; if (!email.match(/@/)) return [ { cmd: 'RESULT', result: false, value: 'The input must have an @' } ]; return [{ cmd: 'RESULT', result: true }]; }"
}
}
}

Fields

FieldDescriptionTypeNotes
contextIndicates the Cotalker Data Model or context from where to extract the data.stringSee Execution Context table below for more details.
srcThe Javascript code used for the automationstringSee the Coding Guide for details.

Execution Context

Functions must be able to have access to some contextual variables: This context must be set so that the JS code has access to these variables. Format: KEY1#VALUE1,KEY2#VALUE2,...

Examples:

ContextType
respones#self:string
responses#<identifier>string
user#meCOTUser
user#responderCOTUser
user#creatorCOTUser
user#<id>COTUser
group#selfCOTGroup
group#<id>COTGroup
channel#selfCOTChannel
channel#<id>COTChannel
property#channelCOTProperty
property#user:COTProperty
property#<id>COTProperty
survey#selfCOTSurvey
survey#<id>COTSurvey
question#selfCOTQuestion
time#unixmsnumber
location#latlonstring, e.g. (17.21323:21:21323)

Additional Resources

Help