Hi All
When i create a record on appserver i also need to create unique record id number. We use sequences to create this. Unfortunatelly the field with id is not populated in database trigger.
FOR EACH ttHeaderBefore TRANSACTION :
FIND ttHeader WHERE ROWID(ttHeader) = BUFFER ttHeaderBefore:AFTER-ROWID EXCLUSIVE-LOCK NO-ERROR.
validation ...
IF errorMessage = '' THEN
DO:
I think that the id number could be populated somewhere here or maybe after save-row-changes.
BUFFER ttHeaderBefore:SAVE-ROW-CHANGES().
IF BUFFER ttHeaderBefore:ERROR THEN DO:
END.
BUFFER ttHeaderBefore:ACCEPT-ROW-CHANGES ().
END.
ELSE
DO:
DATASET dsHeader:ERROR = TRUE.
BUFFER ttHeader:ERROR = TRUE.
BUFFER ttHeader:ERROR-STRING = errorMessage.
END.
END.
Thank you
Peter
I think that the id number could be populated somewhere here or maybe after save-row-changes.
You could populate it before save-row-changes in the temp-table (the after-table).
Thank you Mike
I did try this but without success.
IF errorMessage = '' THEN
DO:
ttHeader.hdr_id = next-value (hdrnum).
BUFFER ttHeaderBefore:SAVE-ROW-CHANGES(1,"hdr_id").
IF BUFFER ttHeaderBefore:ERROR THEN DO:
END.
BUFFER ttHeaderBefore:ACCEPT-ROW-CHANGES ().
END.
Thanks
Peter
ttHeader.hdr_id = next-value (hdrnum).
>
> BUFFER ttHeaderBefore:SAVE-ROW-CHANGES(1,"hdr_id").
Well, adding the field to the skipped field list of the SAVE-ROW-CHANGES method won't be to helpful when you want the field in the DB table to be populated from the temp-table field...
Thanks a lot.
You opened my eyes. I did try too many variations so i confused myself .
Peter