ProdataSet : Error 11942

Posted by jmls on 05-Apr-2013 17:28

Before I go into the garage and find an axe to take to my laptop ... would someone please tell me what I am doing wrong here.

I have a dataset, with 1 single temp-table in it. This table was created-like sports.customer

I have set :tracking-changes on the temp-table to true.

lv_Buffer:table-handle:tracking-changes = true.

I make some changes, and save them to the temp-table record.

I now want to save said changes. Following the guides, I have got this:

    def var Changes as handle no-undo.

    create dataset Changes.



and here is the code to actually do the changes

[snipped to remove the code to traverse buffers etc]

p_buffer = Changes:get-top-buffer(1).

    def var lv_BeforeBuffer as handle no-undo.

    def var lv_BeforeQuery  as handle no-undo.

    def var lv_DataSource   as handle no-undo.

    lv_BeforeBuffer = p_Buffer:before-buffer.

    if valid-handle(lv_BeforeBuffer) then

    do on error undo, throw:

      create query lv_BeforeQuery.


      lv_BeforeQuery:query-prepare(substitute("for each &1" + lv_BeforeBuffer:name)).



      do while not lv_BeforeQuery:query-off-end:


        if lv_BeforeBuffer:error then assign lv_BeforeBuffer:rejected = true.



this code was basically lifted straight out of the manual.

However, when I run it I get the error

"SAVE-ROW-CHANGES for BEFORE buffer BIcustomer requires that the corresponding AFTER dataset member buffer customer be attached to a DATA-SOURCE"

if that's the case then

#1 why the *&&%^% isn't it in the manual / example

#2 how the hell do I fix it ? there is no AFTER table (aftger-buffer is ?)

no hair left

All Replies

Posted by Peter Judge on 08-Apr-2013 09:18

#1: If it's not in the manual log a bug.

#2: Since it's Monday this may ruin your week for you ... the 'normal' and before buffers/tables are linked to each other. So one is the other's before and the other, the other's after

Since there's just one buffer handle type, it will have a before and after attribute. Only one will be populated.


ttData is the BEFORE-TABLE beforeData's AFTER table.

If you want to use SAVE-ROW-CHANGES(), you need to attach a datasource (as one does for FILL operations). It does not have to be the same datasource (although typically is). If you don't use a datasource, I think you need to manually do a BUFFER-COPY from the tt to the db table

So you'd need to

DEFINE DATA-SOURCE srcCustomer FOR sports.Customer.


And DETACH-DATA-SOURCE when you're done.

-- peter

Posted by jmls on 13-Apr-2013 13:36

Thanks Peter. I will log a documention bug report

Now that I have managed to work it all out, I've created a couple of classes that handle it for you.

assign p_Dataset = (new dotr.ActiveRecord.DataSet("Name")):Create():AddTable("Customer"):Fill("for each customer no-lock"):handle.

it's a little easier to understand

This thread is closed