getDeclarativeSyntax()
Return a JavaScript object containing the field syntax properties as defined in the field's definition.
Return=
Field.
getDeclarativeSyntax()
Example: vProps += 'Syntax: ' +
JSON.stringify(this.getDeclarativeSyntax()) + '\n' ;
Arguments
None
Return Value
Return—a JavaScript object with each attribute representing a field syntax property set . For example, in JavaScript Object Notation (JSON), such an object is represented as:
{ "DIG" : true, "LEN" : { "min" : 3, "max" : 5 } }
Description
The getDeclarativeSyntax returns the original field syntax definition. If properties have been changed in JavaScript (using getSyntaxProperties or getSyntaxProperty), they are not reflected in this object.
Property | JavaScript Data Type | Values | Description/Remarks |
---|---|---|---|
NED
|
Unsupported. Use property html:readOnly instead |
— | No edit allowed in this field. |
DIM
|
Unsupported. Use property html:disabled instead |
— | Dim field. No edit and no prompt. |
ENT
|
string | Uniface entry format string | Syntax for data entry. For example,
"&*" (zero or more [a-zA-Z]). For more information, see Field Syntax Codes. |
LEN
|
object | { min: Number, max: Number }
|
Length of field or subfield. |
ASC
|
boolean | ASCII, in Unicode range 00-7F | |
BRM
|
boolean | Check that brackets match. | |
DIG
|
boolean | Digits only (0-9) | |
DLS
|
boolean | Delete leading spaces. | |
DLZ
|
boolean | Delete leading zeros. | |
LOW
|
boolean | All lowercase | |
MAN
|
boolean | Mandatory field (minimum length of one). | |
NUM
|
boolean | Numbers only (0-9, . + -) | |
RCS
|
boolean | Replace contiguous spaces with one space. | |
UPC
|
boolean | All uppercase |
Using getDeclarativeSyntax
The object returned by getDeclarativeSyntax could be used in the OnSyntaxError and OnSyntaxErrorResolved triggers to determine the expected values of syntax properties:
var vSyntaxObject = this.getDeclarativeSyntax(); var dls = syntaxObject.DLS; // dls is now true; var len = syntaxObject.LEN; // len is now Javascript object {"min":1,"max":20} var min = len.min; // min is 1 var max = len.max; // max is 20 var man = syntaxObject.MAN; // man is now true.