Page tree
Skip to end of metadata
Go to start of metadata

The pjs.defineDisplay() API creates a rich display file object that can be used by the program. 

Parameters

  1. 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.
  2. JSON file (string) : The name of the JSON file containing your Rich Display definition. 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.
  3. configuration (object): Configuration options for the Rich Display File. See table below.

Configuration Object

Element NameElement TypeDescription
absolutePathBoolean

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.

ignoreArray

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.

includeArray

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.

infDSString

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:

  • 1-8 (Character) or special: "*file" - The first 8 characters of the file name
  • 38-45 (Character) or special: "*record" - The first 8 characters of a record format name being processed
  • 81-82 (Character) - Open Data Path type. "DS" for Rich Display Files.
  • 83-92 (Character) - Name of the file being opened
  • 93-102 (Character) - Name of the library containing the file
  • 197-206 (Character) - Name of the requester device
  • 261-270 (Character) - Record Format Name
  • 369-369 (Character) - AID byte value
  • 370-370 (Unsigned integer - length: 3) - Cursor row
  • 371-371 (Unsigned integer - length: 3) - Cursor column
  • 376-377 (Unsigned integer - length: 5) - Subfile Relative Record Number (RRN)
  • 378-378 (Unsigned integer - length: 5) - Top record RRN
  • 380-381 (Unsigned integer - length: 5) - Number of records in the subfile
  • 382-382 (Unsigned integer - length: 3) - Active window cursor row
  • 383-383 (Unsigned integer - length: 3) - Active window cursor column
flagDSStringName 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.
modeString

Currently supported values:

  1. "compatibility" - all field names for this Rich Display File are converted into lower case.
  2. "case-sensitive" - field names are kept in the same case as defined on bound properties within the Rich Display File (support for this mode value is experimental at this time)

If omitted, the default value used is "compatibility"; however, the default can be overwritten in the Profound.js configuration file. See defaultMode configuration.

prefixObject / 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.

  1. As an object of the following format:
    {
    "numberOfCharsToReplace": nn, //numeric value indicating the number of characters, if any, in the existing field names to replace with the prefix
    "prefix": "xxxx" //string prefix value. If numberOfCharsToReplace is not defined or is 0, then the prefix is appended to the beginning of the field names
    }
  2. As a string value that will be appended to the beginning of the field names.
renameObject

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"
}
renameFieldsObject

Object containing field names to rename within the Rich Display File; the field names are given as properties of this object and their new names as values of these properties.

For example:

{
"field1": "newField1",
"field2": "newField2"
}

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:

{
"EXfield1": "newField1",
"EXfield2": "newField2"
}
rrnFieldsObject

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.

staticBoolean

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.

userOpenBoolean

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.

aliasBooleanIf 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.

 

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 character field in it 
// named 'field1' 
pjs.defineDisplay("test.json", 
{ 
  prefix: 'xx',
  renameFields: { 
    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();