| Argument | Description | Types / Required |
| name | The name of a dictionary associated with an application. | string
not required |
| path | The path of a dictionary file to read. | string
not required |
The
Dictionary.getDictionary action returns a dictionary 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 an
application or
form file. When using an application name, the application's
main dictionary is returned. When using a form file name, the dictionary associated with the forms is returned.
If neither name nor path are specified, the application's main dictionary is returned.
The action returns the dictionary.
The action throws an exception if any of its arguments are not specified in a valid form, or if:
- No dictionary, or associated dictionary, exists with the specified name.
- The dictionary file does not exist or cannot be read.
// write to the console all of the item names along with their parent record
const dictionary = CS.Dictionary.getDictionary({
path: "Census Dictionary.dcf"
});
dictionary.levels.forEach(level => {
level.ids.items.forEach(item => {
console.log(`ID: ${item.name}`);
});
level.records.forEach(record => {
record.items.forEach(item => {
console.log(`${record.name}: ${item.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);