pjs.defineDisplay()
The pjs.defineDisplay()Â API creates a rich display file object that can be used by the program.Â
Parameters
name (optional string): The object name you will reference throughout your program that represents the Rich Display File created by pjs.defineDisplay(). A common convention is to set this value to "display" as seen throughout the documentation. If the name is omitted, the object name becomes the json file name without the file extension.
filename (string) : The name of the JSON file containing your Rich Display definition or the name of a 5250 Display File (new in profound.js 6.X.X). Rich Display JSON files are created using the Visual Designer tool. The file is searched for in the modules directory of the Profound.js installation. The name can be qualified with a specific modules subdirectory (e.g. "subdir/mydisplay.json"). If the name is not qualified, the pathlist is used to search for the Rich Display File.
configuration (object): Configuration options for the Rich Display File. See table below.
Configuration Object
Element Name | Element Type | Description |
---|---|---|
absolutePath | Boolean | Flag that can be set to true if the path for the json file containing the Rich Display File is absolute. If omitted, false is assumed. |
ignore | Array | Array containing a list of record format names that should be ignored by the Node.js module. The module runs as if the specified record format(s) did not exist. When the ignore property is specified, the include property should not be specified. |
include | Array | Array containing a list of record format names that should be included by the Node.js module; all other record formats contained in the Rich Display File will be ignored. When the include property is specified, the ignore property should not be specified. |
infDS | String | Name of a data structure that will be used as the File Information Data Structure for the Rich Display File. The following positions within the data structure are automatically populated:
|
flagDS | String | Name of a data structure that is associated with the display file indicators or flags. The data structure contains the conditioning and response indicators passed to and from the display. If not specified, the module's built-in flags array is used. |
mode | String | Currently supported values:
If omitted, the default value used is "compatibility"; however, the default can be overwritten in the Profound.js configuration file. See defaultMode configuration. |
prefix | Object / String | Defines a prefix that will be used to partially rename all the fields of the Rich Display File. This property can be defined in 2 different ways.
|
rename | Object | Object that lets you define new names for any given record format within the Rich Display File. It contains the record format names that you wish to rename as properties, and their new names as values of these properties. For example: { "format1": "newFormat1" "format2": "newFormat2" } |
renameFields | Object | Object containing field names to rename within the Rich Display File; the format names are given as properties of this object and their values are objects with the field names as properties and their new names as values. For example: { If a prefix is defined, the renameFields object properties must be defined with the prefix in place in order for those fields to be renamed. For example, if the property prefix is defined as string "EX", then renameFields might look like this: { |
rrnFields | Object | Object containing a list of subfile record formats in the Rich Display File as properties, and their relative record number field names as corresponding string values. For example: { "sfl": "rrn", "sfl2": "rrn2" } The field names must be defined within the Node.js module. |
static | Boolean | If true, the display file will remain open until either display.close() is called or the activation group ends. If false, the display file will remain open until either a display.close() is called or the parent function exits. |
userOpen | Boolean | Flag indicating that the display file will not be implicitly opened by the system. The Node.js module will have to manually open the Rich Display File using the display.open() method. If omitted, false is assumed. |
alias | Boolean | If set to True, the alias (alternate) names will be used, if present, for the fields associated with the file and also for subfield names in data structures defined with the 'likeRec' option. |
prefixWithFormatName | Boolean | If set to True, all fields will be created with the name of the format they are defined in as a prefix. |
Examples
// pjs.defineDisplay without passing a "name" or "configuration" parameter
// The object name defaults to the Rich Display File's name (minus extension)
pjs.defineDisplay("test.json");
// Logic setting initial values, etc...
test.fmt.execute();
// Process screen submission...
// pjs.defineDisplay example with no "name" parameter, and with the prefix and rename fields
// configuration options defined
// Assume test.json has a format named ctl with a character field in it
// named 'field1'
pjs.defineDisplay("test.json",
{
prefix: 'xx',
renameFields: {
ctl: {
xxfield1: 'newField'
}
}
});
Â
pjs.define("data", { type: 'char', length: 50, varying: true });
test.fmt.execute();
Â
// We can now refer to 'newField' in the module
// even though the original name of the field was 'field1'
data = pjs.char(newField);
// pjs.defineDisplay example using infDS, rrnFields, rename, and userOpen
// as configuration options
Â
pjs.defineDisplay("display", "subfiled.json",
{ infDS: 'FILEFBK',
rrnFields: {
sfl: 'RRN'
},
rename: {
ctl: 'ctlx'
},
userOpen: true
});
pjs.define("RRN", { type: 'integer' });
pjs.define("FILEFBK", { type: 'data structure', elements: {
"FILE": { special: '*file' },
"OPEN_IND": { type: 'boolean' },
"EOF_IND": { type: 'boolean' },
"RCD_FMT": { type: 'char', from: 261, to: 270 }
}});
display.open();
Â
// Subfile clearing and populating, etc..
Â
display.ctlx.execute();
Â
// Process screen submission...
display.close();