Problem saving row changes with ProDataSet.

qcreader

New Member
Hello:

I am new to Progress progamming.

I am building a new application but I am have trouble when attempting to update a records (as opposed to writing a new record.

The error message is:

"Unable to find record for db buffer pjt_det during SAVE-ROW-CHANGES. (11912)"

Here is my code (below).

This code works for adding data, but not for updates except when there is but one record in the table.

The error occurs on more than one table, in exactly the same manner.

The error is generated at this line:

"BUFFER ttTotesBefore:SAVE-ROW-CHANGES()."

Any thoughts will be appreciated.

Best,

Quentin Reader.

/* ***************************** */
/* Update Tote records section: */
/* ****************************** */
/* Get a handle on the after-buffer for the totes temp table: */
BUFFER ttTotes:ATTACH-DATA-SOURCE(DATA-SOURCE srcPJTotes:HANDLE).
hAfterBuf = hDSChanges:GET-BUFFER-HANDLE("ttTotes").
IF NOT (ERROR-STATUS:ERROR = hAfterBuf:FIND-FIRST()) THEN
DO:
/* Retrieve the corresponding before-table buffer in this way: */
hBeforeBuf = hAfterBuf:BEFORE-BUFFER.
/* The BEFORE-TABLE and AFTER-TABLE attributes are on the temp-table handles and return */
/* a temp-table handle. The BEFORE-BUFFER and AFTER-BUFFER attributes are on the buffer */
/* handles and return a buffer handle. */
/* The before table is defined on the temp table, in dsPackJackTT.i */
/* We cycle through the buffer on the before table and save changes, as required. */

FOR EACH ttTotesBefore:
BUFFER ttTotes:FIND-BY-ROWID(BUFFER ttTotesBefore:AFTER-ROWID).
BUFFER ttTotesBefore:SAVE-ROW-CHANGES().
END.
hAfterBuf:ACCEPT-CHANGES.
END.
ELSE
.
/* ***************************: */
/* End Update Tote records section: */
/* ***************************: */
 
You don't post the code where one can see the definition of the data source object - therefore I am just guessing ...

Did you define a key when you defined the data source? When saving the row changes the key is needed to locate the record in the database that should be updated from the Temp-Table. Have a look at the DEFINE DATA-SOURCE statement.

Heavy Regards, RealHeavyDude.
 
RealHeavyDude is right, or at least on the right track. My manager, Tim Clay, figured this out.

Thanks to RealHeavyDude and to all those who have given this problem a look.

It turned out that the key values used for the data source definitions were incorrect.

So this is a litttle cautionary tale to double-check those.

Here they are, corrected:

DEFINE DATA-SOURCE srcPJMaster FOR QUERY qPJMaster pjm_mstr KEYS (pjm_domain, pjm_jobid).
DEFINE DATA-SOURCE srcPJTotes FOR pjt_det KEYS (pjt_domain, pjt_jobid, pjt_serial).
DEFINE DATA-SOURCE srcPJPackers FOR pjp_det KEYS (pjp_domain, pjp_jobid, pjp_packerid, pjp_start).
DEFINE DATA-SOURCE srcPJContainers FOR pjc_det KEYS (pjc_domain, pjc_jobid, pjc_serial, pjc_start).
 
Back
Top