Kbase P164238: 4GL/ABL: Error 223 comparing NOW arithmetical expression with a DATETIME variable
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  21/04/2010 |
|
Status: Unverified
SYMPTOM(s):
4GL/ABL: Error 223 comparing NOW arithmetical expression with a DATETIME variable
** Incompatible data types in expression or assignment. (223)
A comparison between a DATETIME variable with an arithmetical expression involving the NOW function generates error 223 unless the NOW function stands alone on one side of the inequality.
The error is generated a comparison is made between an arithmetical expression involving the NOW function and some other items on one side and a DATETIME expression on the other. For example, the inequality (NOW + 132 GT dtVar ) in the following code snippet generates the above error:
DEFINE VARIABLE dtVar AS DATETIME NO-UNDO INITIAL NOW.
MESSAGE NOW + 132 GT dtVar VIEW-AS ALERT-BOX.
FACT(s) (Environment):
If the NOW function stands alone on either side of the inequality, an its return DATETIME-TZ value is implicitly converted to a DATETIME data type and no error is generated. For example:
DEFINE VARIABLE dtVar AS DATETIME NO-UNDO INITIAL NOW.
MESSAGE NOW GT dtVar - 123 VIEW-AS ALERT-BOX.
All Supported Operating Systems
OpenEdge 10.1x
OpenEdge 10.2A
OpenEdge 10.2B
CAUSE:
Bug# OE00197114
CAUSE:
When the NOW function ALONE is compared to a DATETIME expression, the DATETIME-TZ value returned by the NOW function is implicitly converted to DATETIME data type allowing the comparison to succeed. However, an arithmetical expression involving the NOW function with some other terms is compared to a DATETIME expression, the DATETIME-TZ value returned by the NOW function is NOT implicitly converted to DATETIME data type and hence the error.
FIX:
None at this time. Use one of the follwing three workarounds:
1. Change the data type of the variable to DATETIME-TZ. For example:
DEFINE VARIABLE dtVar AS DATETIME-TZ NO-UNDO INITIAL NOW.
MESSAGE NOW + 132 GT dtVar VIEW-AS ALERT-BOX.
2. Use the DATETIME and STRING functions. For example:
DEFINE VARIABLE dtVar AS DATETIME NO-UNDO INITIAL NOW.
MESSAGE DATETIME(STRING(NOW + 132 )) GT dtVar VIEW-AS ALERT-BOX.
3. Move all arithmetic operators to the side of the expression opposite the NOW function. For example:
DEFINE VARIABLE dtVar AS DATETIME NO-UNDO INITIAL NOW.
MESSAGE NOW > dtVar - 132 VIEW-AS ALERT-BOX.