DA - Delphi 11 - How To Do Transactions

Using latest version of DataAbstract with Delphi 11.

In DA, how do you properly setup and handle transactions with a master table and multiple detail tables.

Example would be an invoice with line item detail and equipment detail.

I am trying to determine how to post the Master record and all the detail in a single database transaction.

Sorry ahead of time if this is found somewhere in the documentation.

Bill Britain
Is2 Software
Flower Mound, Texas

Hi,

check DataAbstractService.ReturnUpdateFailureDelta property

Not how that applies to what I am asking. In our Asta programs, we combined all the datasets into a single transaction set to be sent as a single transaction back to the server. If the transaction failed for whatever reason, the complete set of dataset posts were all rolled back.

This is what we are trying to accomplish with DA. How would we do that?

In the example code below from our ASTA program, we are sending everything for three tables ReceiptMaster, ReceiptDetail, and ArOpenReceivables. One transaction set. The Asta client socket had a SendDataSetTransctions function for combining the tables into a single transaction commit.

////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////

procedure Tsc_ArReceipts.ProcessTransactions;
begin
{
  if ButtonAction = mrOk then
    begin
      try
        ta_ReceiptDetail.MasterSource := nil;
        Sysfunction.AstaClientSocket.SendDataSetTransactions(
        'CustomerReceiptsEntry', [ ta_ReceiptMaster, ta_ReceiptDetail, ta_ArOpen ] );
        ta_ReceiptDetail.MasterSource := ds_ReceiptMaster;
      except
        ShowMessage( 'Problem in completing the Customer Receipt Entry transactions.  Entries rolled back.' );
        ta_ReceiptDetail.CancelUpdates;
        ta_ReceiptMaster.CancelUpdates;
        ta_ArOpen.CancelUpdates;
        ta_ReceiptDetail.MasterSource := ds_ReceiptMaster;
      end;
    end
  else
    begin
      ta_ReceiptDetail.CancelUpdates;
      ta_ReceiptMaster.CancelUpdates;
      ta_ArOpen.CancelUpdates;
    end;
}
end;

////////////////////////////////////////////////////////////////////////////////

Hi,

in your case, you should set ReturnUpdateFailureDelta to False and call

master.ApplyUpdates();

on client side. all details tables will be included if default settings are used.
you also can include several tables into one transaction with

RDA.ApplyUpdates([table1, .. tableN]);

if any change in any table fails, transaction won’t be applied.

Thank you Evgeny. That should work. Will try this weekend.