ProDataSet Issues - Need ideas

Posted by danielStafford on 07-Apr-2011 17:23

10.2B04

I am hoping for some fresh ideas to solve the following problem:

I have a Form (salesView) with two UltraGrids representing eSale and eSaleDetail temp-table records.

I have a model class with a ProDataSet defined as such:

DEFINE DATASET dsSale for eSale, eSaleDetail, eSaleTender.

The data-relations, bindingSources, queries, and other infrastructure works great.

I want the user to be able to create and assemble several sales (and the associated detail for each) and choose at any given time to complete / print each sale independently. This process would send the sale and it's detail to the server business entity for review and, if a problem exists allow them to correct it and eventually the data access layer will complete the transaction.

The issue is that during a session, dsSale at any given moment may have several eSale (and many related eSaleDetail) rows with row-states = "ROW-CREATED".  I only want to send one "sale" over the wire. Currently, I NEW a duplicate saleModel object, buffer-copy the selected eSale and its related eSaleDetail rows to the models target dataset, and send it off (saveChanges).  This works great except for a new transaction type of "Layaway" where I fetch the sale(s) for a particular customer, the user makes modifications (applies another payment) and now the row-states are "ROW-MODIFIED". Doing the buffer-copy doesn't work because the row-states (in the target dataset) will be "ROW-CREATED" and the business entity has logic based on these states (row-created, row-modified, row-deleted). I've tried COPY-DATASET with the current-only flag set, but only the current buffers are copied, meaning that the current eSale and current eSaleDetail buffers are copied, but any additional related eSaleDetail rows are not copied.

What I need is a COPY-DATASET that will copy the current parent (eSale), and all the related rows, not just the current buffers. Outside of this, I would love to hear some ideas.

All Replies

Posted by Peter Judge on 07-Apr-2011 18:39

Have you looked at the GET-CHANGES() method? Although I'm not sure whether it'll meet your layaway requirements. However, there's also a MARK-ROW-STATE() method on the buffer handle which you could use in certain cases.

-- peter

Posted by danielStafford on 08-Apr-2011 10:26

Thanks Peter.

I currently use the GET-CHANGES() method at the service interface.  Almost all (except Layaway) sales are newly created rows. I just want a single eSale row and it's related detail to pass to the server.

MARK-ROW-STATE() takes no action if there is already a before-table record, as is the case when I use the BUFFER-CREATE / BUFFER-COPY methods.

Todays solution uses the COPY-DATASET() method, and as a result I have a target ProDataSet with eSale (and eSaleDetail) rows that I don't want sent to the server. I added a method to the model object that deletes these rows without tracking changes. So far, this seems to work.

Regards.

This thread is closed