ProDataSets: Mergining data back into the prodata set after calling SAVE-ROW-CHANGES.

Cecil

19+ years progress programming and still learning.
INFO: OE 10.2A Studio (not Architect).

Hi All,

This is a simple question but I have not seen a sample code to show what I am trying to do.

I pass a prodataset to a procedure (running on an AppServer) as an INPUT-OUTPUT. If the prodataset contains a new record(s), I let the ABL's SAVE-ROW-CHANGES() method to create the new record on the database. The database trigger will fire the CREATE event (no problems there).

But how after calling the SAVE-ROW-CHANGE() method do I merge the updated field values back into the prodataset which have been assigned by the database create trigger procedure?

Do I have to do another FILL() to populate the eitire prodataset?

Thanks James.
 

Cecil

19+ years progress programming and still learning.
Re: ProDataSets: Mergining data back into the prodata set after calling SAVE-ROW-CHAN

I've attached the (almost) working code.

Code:
DEFINE DATASET dsSite FOR ttSite.
DEFINE INPUT-OUTPUT PARAMETER DATASET FOR dsSite.

/** Data Debug - View what is being sent..**/    
DATASET dsSite:WRITE-XML('File','dsUpdateDebug02.xml', TRUE, ?, ?,?,?,TRUE).
Code:
MAIN-BLOCK:
DO ON ERROR UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK
    ON STOP UNDO MAIN-BLOCK, LEAVE MAIN-BLOCK:

    DEFINE DATA-SOURCE scSite FOR Site KEYS( Site_ID) .
    BUFFER ttSite:ATTACH-DATA-SOURCE (DATA-SOURCE scSite:HANDLE, "") .

    DATASET dsSite:WRITE-XML('File','dsUpdateDebug02.xml', TRUE, ?, ?,?,?,TRUE).

    FOR EACH ttSiteBefore :
        
        /* If the record is new don't populate the site_ID field, as the
           will be assigned by the database trigger.    */

        BUFFER ttSiteBefore:SAVE-ROW-CHANGES('Site','Site_ID') .

        BUFFER ttSiteBefore:ACCEPT-ROW-CHANGES( ).
    END . 
END.

RETURN.
 

Cecil

19+ years progress programming and still learning.
Re: ProDataSets: Mergining data back into the prodata set after calling SAVE-ROW-CHAN

After a few more hours of debugging I've found the problem not to be server side but the client side code. After I received the outputted ProDataset from the called procedure on the AppServer, I use the MERGE-CHANGES() method.

The MERGE-CHANGES() method is returning true to indicate that the process was successful but I can see now that no merge has taken place. Not sure what else to try now...?????
 

Cecil

19+ years progress programming and still learning.
Re: ProDataSets: Mergining data back into the prodata set after calling SAVE-ROW-CHAN

FOUND IT!:cool:

The problem was

BUFFER ttSiteBefore:ACCEPT-ROW-CHANGES( ).

this was screwing up everything. The embarrassing thing was is that
I thought that I had already removed this line of code after reading a
knowledge-base article.
 

Cecil

19+ years progress programming and still learning.
Re: ProDataSets: Mergining data back into the prodata set after calling SAVE-ROW-CHAN

Do you have any database DELETE triggers. This could be rolling back the transaction.

i dont quite get it...
so u simply change SAVE-ROW-CHANGES ( ) into MERGE-CHANGES( ) ??

i'm having problem with prodataSet too.
what i'm facing now is i can add,update dataSet using Save-row-Changes, but when i delete record and passed it to appserver, when appserver execute save-row-changes ( ) its failed. :(

FYI,i'm using openedge 10.2B with .Net as Front End
 

Cecil

19+ years progress programming and still learning.
Re: ProDataSets: Mergining data back into the prodata set after calling SAVE-ROW-CHAN

When you delete the temp-table record, do you have the tracking changes before and after the DELETE statement?

Code:
TEMP-TABLE ttOrder:tracking-changes = TRUE.
DELETE ttOrder.
TEMP-TABLE ttOrder:tracking-changes = FALSE.
Also for debugging purposes I was dumping the dataset to an XML file on the server side to see what was changing by using the following statmenet.

Code:
DATASET dsOrder:WRITE-XML('File','ServerSideOrder.xml', TRUE, ?, ?,?,?,TRUE).

Hope this helps.
 

Cecil

19+ years progress programming and still learning.
Re: ProDataSets: Mergining data back into the prodata set after calling SAVE-ROW-CHAN

i've put the code write-xml
but i cant find where is the xml file in the appserver machine...
where is it ? :-/

Check the working directory of the AppServer. i.e /usr/WRk or C:\OpenEdge\WRK
 
Top