IRdsDictionaryBatch.Callback

Fore Syntax

Callback: IRdsBatchCallback;

Fore.NET Syntax

Callback: Prognoz.Platform.Interop.Rds.IRdsBatchCallback;

Description

The Callback property determines a handler of exceptions that appear during batch execution.It is necessary to create a custom handler class that redetermines all properties and methods of the IRdsBatchCallback interface.

Comments

By default Callback is set to Null, that is, there is no exception handler.

Fore Example

Executing the example requires an MDM repository with the RDS_REPO identifier that contains a non-version MDM dictionary with the DICT identifier.

Add links to the Metabase and Rds system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    RdrRepoDescr: IMetabaseObjectDescriptor;
    RdsDictObj: IMetabaseObject;
    DictInst: IRdsDictionaryInstance;
    DictBatch: IRdsDictionaryBatch;
    DelBatch: IRdsDictionaryBatchDelete;
    Callback: IRdsBatchCallback;
Begin
    mb := MetabaseClass.Active;
    RdrRepoDescr := mb.ItemById("RDS_REPO");
    RdsDictObj := mb.ItemByIdNamespace("DICT", RdrRepoDescr.Key).Edit;
    DictInst := RdsDictObj.Open(NullAs IRdsDictionaryInstance;
    DictBatch := DictInst.CreateBatch(RdsDictionaryBatchType.Delete);
    DelBatch := DictBatch As IRdsDictionaryBatchDelete;
    Callback := New MCallback.Create;
    DelBatch.Callback := Callback;
    DelBatch.Execute;
    RdsDictObj.Save;
End Sub UserProc;

Public Class MCallback: Object, IRdsBatchCallback
    
    Function OnError(Element: Integer; ErrorType: Integer; Error: IException): RdsBatchCallbackContinue;
        Begin
            Debug.WriteLine(Error!);
            Debug.WriteLine(    element:  + Element.ToString);
            Debug.WriteLine(    error type:  + ErrorType.ToString);
            Debug.WriteLine(    error text:  + Error.Message);
            Return RdsBatchCallbackContinue.Continue_;
    End function OnError;
    
    Function CheckExecute(CheckType: integer): boolean;
    Begin
        Return False;
    End Function CheckExecute;

End Class MCallback;

After executing the example the batch used to remove elements with exception handler is created. The batch is executed. All errors occurred during the execution are displayed in the console window.

See also:

IRdsDictionaryBatch