Kbase P25800: Function ColumnValue not returning correct value after a cancelled Save.
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  08/02/2006 |
|
Status: Unverified
FACT(s) (Environment):
Dynamics 2.0A
SYMPTOM(s):
Function ColumnValue not returning correct value after a cancelled Save.
On updating a field (named "neq") on a Static Viewer from a value of 1
to 2, and then saving, using the ValidateFields procedure in the Static
Viewer to obtain the original value of the field. This is done by using
DYNAMIC-FUNCTION('ColumnValue':U IN hsdo,'neq') - where hsdo is the
handle of the SDO. This correctly returns the original value of 1.
If
the Update save process has an error detected in WritePreTransValidate,
cMessagelist is populated and returned and the Update is
cancelled. If Save is pressed again, the ValidateFields procedure
again uses DYNAMIC-FUNCTION('ColumnValue':U IN hsdo,'neq') but now
returns 2 the current screen-value and not 1 as would be expected from
the SDO.
CAUSE:
This is a known issue.
FIX:
A workaround for this particular case could be to add a columnOldValue function to the SDO:
FUNCTION columnOldValue
RETURNS CHARACTER ( INPUT pcColumn AS CHARACTER ):
DEFINE VARIABLE hRowObjUpd AS HANDLE NO-UNDO.
DEFINE VARIABLE hRowObject AS HANDLE NO-UNDO.
DEFINE VARIABLE hRowObjUpdB AS HANDLE NO-UNDO.
{get RowObject hRowObject}.
{get RowObjUpd hRowObjUpd}.
CREATE BUFFER hRowObjUpdB FOR TABLE hRowObjUpd.
IF NOT hRowObject:AVAILABLE THEN RETURN ?.
hRowObjUpdB:FIND-FIRST('WHERE rownum = '
+ STRING(hRowObject:BUFFER-FIELD('rownum'):BUFFER-VALUE)
+ ' AND rowmod = ~'~'') NO-ERROR.
/* NOTE: If this function is going to be used in the SDO, remove 'IN hDataSource' part from function body (below) */
IF NOT hRowObjUpdB:AVAILABLE THEN
RETURN DYNAMIC-FUNCTION('columnValue' IN hDataSource,
INPUT pcColumn).
ELSE
RETURN hRowObjUpdB:BUFFER-FIELD(pcColumn):BUFFER-VALUE.
END FUNCTION.