project BLF > class BCustomField > method ValidateLength
validation procedure
Description
Validation mask for maximum length entered on string custom fields.
Parameters
iiTargetField | input | integer | Value of the business field to validate. |
icTargetFieldName | input | character | Name of the business field to validate. |
icRowid | input | character | Contents of field tc_Rowid, if the target field is a field of a component temp-table. |
icBusinessFieldName | input | character | business field |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
BLF
program code (program1/bcustomfield.p)
assign vcField = entry(2, icBusinessFieldName, ".").
if not vcField begins "Custom"
then assign vcField = substr(vcField, 3, -1, "CHARACTER").
if vcField begins "CustomShort" or
vcField begins "CustomCombo"
then assign viMaxLength = 20.
else
if vcField begins "CustomLong" or
vcField = "QADC02"
then assign viMaxLength = 255.
else
if vcField begins "QADC0"
then assign viMaxLength = 40.
else
if vcField begins "CustomNote"
then assign viMaxLength = 4000.
else
if vcField begins "CustomInteger"
then assign viMaxLength = 9.
else
if vcField begins "CustomDecimal"
then assign viMaxLength = 18.
if viMaxLength > 0 and
viMaxLength < iiTargetField
then do:
<M-1 run SetMessage
(input #T-2'Defined field length exceeds maximum allowed length ($1).':100(478)t-2# (icMessage),
input string(viMaxLength) (icArguments),
input icTargetFieldName (icFieldName),
input string (iiTargetField) (icFieldValue),
input 'E' (icType),
input 3 (iiSeverity),
input icRowid (icRowid),
input 'BLF-63':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BCustomField>
assign oiReturnStatus = -1.
end.