Description


$fieldinfo(MYFIELD,\"SYNTAX\") should return ALL possible declarative field syntax string. The whole list is available into \"Field Syntax Definitions\" chapter, Table 6. Shorthand codes

Use Case


Catching user error as soon as possible is often an easy way to improve application quality perception from customers. Customers used to have Uniface application from older version are used to behaviour of Unifields; Unifields could directly filter keypressed based on field DataType. When an enduser press an alfabetic key (maybe as a mistake) on a Numeric field displayed as Unifield immediately gets an error: 3016 - Numeric field only (0-9 . , + -) are allowed EditBoxes as of 9.6.07-X704 do not control input characters but postpone checking when enduser try to leave the field; if NOT allowed characters were typed Uruntime generates a generic error: 0123 – Error on field: ; illegal format for field If programmer want to somehow mimic Unifields behaviour in EditBoxes could: Activating OnEdit Extended Trigger based on need: $fieldproperties(YOURFIELD) = “OnEdit=True” (please consider also EditDelay to give user a quick answer!) Extended Trigger content for YOURFIELD: trigger onEdit variables string myLastChar string myValue endvariables if ($fieldinfo($fieldname, “DATATYPE”) = “Numeric” | $fieldinfo($fieldname, “DATATYPE”) = “Float”) myValue = @$fieldname myLastChar = myValue[$length(myValue)] if (myLastChar != ‘#’ & myLastChar != “.” & myLastChar != “,” & myLastChar != “+” & myLastChar != “-“) @$fieldname = myValue[1, $length(myValue)-1] message $text(3016) return(-1) endif endif end There is no way as of 9.6.07-X704 to further refine this piece of code, adding as an example DIGIT ONLY checking, because $fieldinfo(MYFIELD,\"SYNTAX\") only returns a partial set of fieldinfo sintaxes, those directly manageble through $fieldsyntax(): HID, DIM, NDI, NED, NPR. It is requested all compiled shorthand codes should be returned (See Table 6 as described).

Importance


Medium

Type


Proc Code

Operating System


Not Applicable

Status


Open

Leave a Reply