Options

strange behavior of cu 423

redStriperedStripe Member Posts: 83
Hello,
during the insert of a changelogentry (Table 405) I execute code in the
CU 423 ChangeLogMng. in the InsertLogEntry trigger, which check the value
of the field "NewValue". This check should execute during each insert -
but the problem is that is allways shifted. i mean after every start of Navision
and the run through this check-function nothing happen. but in the second try
the function checks the value from the last run.

Can someone explain me that behavior?

here is the code:
InsertLogEntry(VAR FldRef : FieldRef;VAR xFldRef : FieldRef;VAR RecRef : RecordRef;TypeOfChange : 'Insertion,Modification,Deletion')
ChangeLogEntry.INIT;
ChangeLogEntry."Date and Time" := ROUNDDATETIME(CURRENTDATETIME,1000);
ChangeLogEntry.Time := DT2TIME(ChangeLogEntry."Date and Time");
ChangeLogEntry."User ID" := USERID;
ChangeLogEntry."Table No." := RecRef.NUMBER;
ChangeLogEntry."Field No." := FldRef.NUMBER;
ChangeLogEntry."Type of Change" := TypeOfChange;
IF (RecRef.NUMBER = DATABASE::User) AND (FldRef.NUMBER = 2) THEN BEGIN // Password
  ChangeLogEntry."Old Value" := '*';
  ChangeLogEntry."New Value" := '*';
END ELSE BEGIN
  IF TypeOfChange <> TypeOfChange::Insertion THEN
    ChangeLogEntry."Old Value" := FormatValue(xFldRef,RecRef.NUMBER);
  IF TypeOfChange <> TypeOfChange::Deletion THEN
    ChangeLogEntry."New Value" := FormatValue(FldRef,RecRef.NUMBER);
END;

//bsw1000+
CLEAR(Check_value_rec);
Check_value_rec.SETRANGE(Check_value_rec."Table No.",ChangeLogEntry."Table No.");
Check_value_rec.SETRANGE(Check_value_rec."Field No.",ChangeLogEntry."Field No.");
IF Check_value_rec.FIND('-') THEN BEGIN
  ChangeLogEntry.Prüfwert := Check_value_rec.ValidString;
  MESSAGE('Prüfwert %1',ChangeLogEntry.Prüfwert);
  IF ChangeLogEntry.Prüfwert <> ChangeLogEntry."New Value" THEN
    ERROR(Text000,Check_value_rec.ValidString);
END;
//bsw1000-


thanks.

redStripe.

Answers

Sign In or Register to comment.