Consultor Eletrônico



Kbase P129268: Fill-in defined as Date allows hyphens / dashes (-) in the Year portion
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   2/26/2008
Status: Unverified

FACT(s) (Environment):

Progress 9.x
OpenEdge 10.x

SYMPTOM(s):

Fill-in defined as Date allows hyphens / dashes (-) in the Year

Possible to enter a date with format 99/99/----

Error 85 results when trying to commit a date with such a format

** Invalid date input. (85)

Possible to enter dashes in other formats which are accepted as valid dates:

01/12/-333
01/12/333-
01/12/-33-

CAUSE:

The hyphen / dash (-) character is valid within a date with respect to being a date separator character and to indicate negative (BC) dates

FIX:

Option #1
Add error-checking to the date field to avoid the default Progress error. For example, the following is simple LEAVE trigger that overrides the default Progress error:

DEFINE VARIABLE dDate AS DATE NO-UNDO.
dDate = DATE(fill-in-1:SCREEN-VALUE) NO-ERROR.

IF ERROR-STATUS:ERROR OR ERROR-STATUS:NUM-MESSAGES > 0 THEN DO:
MESSAGE "This date is not valid"
VIEW-AS ALERT-BOX INFO BUTTONS OK.
RETURN NO-APPLY.
END.

Option #2
Take away the option to type in dates, replacing it with such alternatives as combo-boxes for the Day/Month/Year or a calendar control, either of which will limit available choices to valid date combinations.