Consultor Eletrônico



Kbase P98672: error 74 when using the Dynamics calculator and format is too small in target widget
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   12/16/2004
Status: Unverified

FACT(s) (Environment):

Dynamics
openEdge 10.0B

SYMPTOM(s):


"** Value <value> cannot be displayed using <format>. (74)"

Choosing OK in the Dynamics popup calculator

CHANGE:

This was not doing that in 10.0A when the target field had a too small format (like trying to set 12345 in a "99" format)

CAUSE:

Known issue, development aware. Actually, the situation has been improved in 10.0B since the error is caught in af/obj2/afcalcpopd.w and it intentionally displayed to show the format problem. Now because error 74 is displayed as a native Progress error message, then one can take it as a situation that is badly handled.
This situation should actually be handled by a Dynamics message that could be translated in any language, but that would still help the developer with the native error 74 to see the format problem.

FIX:

The following fix has been successfully tested in 10.0B01:

Message group "ME" (like 'my message', of course the bug fix will create a message in AF or alike)
Message number '1'
Language 'english' (you can translate it afterwards)
Check source language toggle-box
Msg summary: "The calculator cannot parse the result. See details"
Msg Type: Warning
<Msg full desc>
The calculator cannot parse the result. Perhaps the format of the field is too small
Progress returns the following error
&1
</Msg full desc>

Then put the following code in af/cod2/afcalcpopd.w/GO trigger of the Dialog-frame:

DO:
DEFINE VARIABLE cCurrentValue AS CHARACTER NO-UNDO.
DEFINE VARIABLE cError AS CHARACTER NO-UNDO.
DEFINE VARIABLE cMessageList AS CHARACTER NO-UNDO.

IF VALID-HANDLE(ip_handle) AND CAN-QUERY(ip_handle,"screen-value":U) THEN
DO:
DEFINE VARIABLE dValue AS DECIMAL INITIAL 0 NO-UNDO.
ASSIGN dValue = DECIMAL({fnarg formatValue fi_value:SCREEN-VALUE}) NO-ERROR.
ASSIGN
cCurrentValue = ip_handle:SCREEN-VALUE
ip_handle:SCREEN-VALUE = STRING(dValue) NO-ERROR.
IF ERROR-STATUS:GET-MESSAGE(1) > '' THEN
DO:
cError = ERROR-STATUS:GET-MESSAGE(1).
ip_handle:SCREEN-VALUE = cCurrentValue NO-ERROR.

cMessageList = cMessageList + (IF NUM-ENTRIES(cMessageList,CHR(3)) > 0 THEN CHR(3) ELSE '':U) +
{aferrortxt.i 'ME' '1' '' '' cError}.
RUN showWarningMessages IN gshSessionManager (INPUT cMessageList /* messages */
,INPUT "" /* msg type */
,INPUT "" /* title */).
/*MESSAGE cError
VIEW-AS ALERT-BOX ERROR.*/
RETURN NO-APPLY.
END.
END.
END.