Argument | Description | Types / Required |
name | The name of an application. | string
not required |
path | The path of a question text file to read. | string
not required |
The
Application.getQuestionText action returns the question text associated with an application or loaded from the disk. One, and only one, of the arguments
name or
path must be provided.
If specifying
name, you can also specify the name of a
form file or a
dictionary. When using a form file or dictionary, the question text associated with that entity's application is returned.
If neither name nor path are specified, the application's question text is returned.
The action returns the question text.
The action throws an exception if any of its arguments are not specified in a valid form, or if:
- No application, or associated form file or dictionary, exists with the specified name.
- The name identifies an application that does not have question text.
- The question text file does not exist or cannot be read.
// write to the console the name of all entities with question text
const questionText = CS.Application.getQuestionText({
path: "Census Data Entry.ent.qsf"
});
questionText.questions.forEach(question => {
console.log(question.name);
});
// construct the input needed for the questionnaire view, using the external dictionary
// attached to this application but getting the forms and question text from the disk
string questionnaireViewInput =
maketext("{ \"dictionary\": %s, \"forms\": %s, \"questionText\": %s, \"case\": %s }",
CS.Dictionary.getDictionary(name := "MARINE_DICT"),
CS.Application.getFormFile(path := "Marine Mammals Survey.fmf"),
CS.Application.getQuestionText(path := "Marine Mammals Survey.ent.qsf"),
CS.Data.getCase(name := "MARINE_DICT"));
// pass this input to the questionnaire view
CS.UI.view(path := Path.concat(html, "questionnaire-view", "index.html"),
inputData := @object questionnaireViewInput);