Dossier::EndTransactionalImport (Interface: Dossier)
 
Ends a transaction for multiple imports.
 
void EndTransactionalImport (
    VARIANT_BOOL bSuccess
)
 
Parameters
bSuccess
[in] True if you want to commit all changes made during the transaction, false for rolling back those changes.
 
Remarks
The value for the parameter bSuccess must not depend on the return values of the import routines that were called during the transaction. If one of the imports fails, the changes made to the files are rolled back independently of the value of the parameter bSuccess.
This parameter can be used if you want to rollback the changes for a reason outside the import routines.
When the transaction is committed either all imports are executed or none of them is. ('all or nothing')
It is important to keep the period between starting and ending the transactional import as short as possible. During this transaction none of the files involved can be modified by other users. It is therefore adviseable to not show any user interface during the transactional import.
This method can be only be used for objects of the same dossier!
None of the imported items will be available in the files as long as the transactional import is busy. It is only after the transaction is completed that all (or none) of the items are visible in the files.
 
See Also
CreateDossierContext
BeginTransactionalImport
Custm.Import
Sales.Import
 
Samples
 
C++
 
// Import customers and their sales documents in one transaction
VARIANT vImported, vErrMsg;
VARIANT_BOOL bOK;

pDossier->BeginTransactionalImport ();
    if (pCustm->Import ("C:\\Import\\Desc\\Custm.cli", "C:\\Import\\Data\\Custm.txt", 0, VARIANT_TRUE, VARIANT_FALSE, VARIANT_FALSE, &vImported, &vErrMsg))
    {
        // bOK = ...: value is determined by checking something
        if (bOK)
            pSales->Import ("C:\\Import\\Desc\\Sales.cli", "C:\\Import\\Data\\Sales.txt", 0, VARIANT_TRUE, VARIANT_FALSE, VARIANT_FALSE, &vImported, &vErrMsg);
    }
pDossier->EndTransactionalImport (bOK);

// Messages with user interface can be given here...

C#
 
// Import customers and their sales documents in one transaction
object oImported, oErrMsg;
bool bOK;

oDossier.BeginTransactionalImport ();
    if (oCustm.Import (@"C:\Import\Desc\Custm.cli", @"C:\Import\Data\Custm.txt", 0, true, false, false, out oImported, out oErrMsg))
    {
        // bOK = ...: value is determined by checking something
        if (bOK)
            oSales.Import (@"C:\Import\Desc\Sales.cli", @"C:\Import\Data\Sales.txt", 0, true, false, false, out oImported, out oErrMsg);
    }
oDossier.EndTransactionalImport (bOK);

// Messages with user interface can be given here...

VBS
 
' Import customers and their sales documents in one transaction
Dim oImported, oErrMsg
Dim bOK

Call oDossier.BeginTransactionalImport()
    If oCustm.Import("C:\Import\Desc\Custm.cli", "C:\Import\Data\Custm.txt", 0, True, False, False, oImported, oErrMsg) Then
        ' bOK = ...: value is determined by checking something
        If bOK Then
            oSales.Import("C:\Import\Desc\Sales.cli", "C:\Import\Data\Sales.txt", 0, True, False, False, oImported, oErrMsg)
        End If
    End If
Call oDossier.EndTransactionalImport(bOK)

' Messages with user interface can be given here...

VB.NET
 
' Import customers and their sales documents in one transaction
Dim oImported, oErrMsg As Object
Dim bOK As Boolean

oDossier.BeginTransactionalImport()    
    If oCustm.Import("C:\Import\Desc\Custm.cli", "C:\Import\Data\Custm.txt", 0, True, False, False, oImported, oErrMsg) Then
        ' bOK = ...: value is determined by checking something
        If bOK Then
            oSales.Import("C:\Import\Desc\Sales.cli", "C:\Import\Data\Sales.txt", 0, True, False, False, oImported, oErrMsg)
        End If
    End If
oDossier.EndTransactionalImport(bOK)

' Messages with user interface can be given here...