IRdsDictionaryInstance.CreateBatch

Syntax

CreateBatch(BatchType: RdsDictionaryBatchType): IRdsDictionaryBatch;

Parameters

BatchType. Type of elements batch.

Description

The CreateBatch method creates elements batch of the MDM dictionary.

Comments

The batch is used to execute any operations over all elements in the batch simultaneously.

Example

Executing the example requires that the repository contains a version table MDM dictionary with the DICT identifier.

Add links to the Metabase, Rds system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    RdsDictObj: IMetabaseObject;
    DictInst: IRdsDictionaryInstance;
    DictBatch: IRdsDictionaryBatch;
    DelBatch: IRdsDictionaryBatchDelete;
Begin
    // Get current repository
    mb := MetabaseClass.Active;
    // Get dictionary
    RdsDictObj := mb.ItemById("DICT").Edit;
    DictInst := RdsDictObj.Open(NullAs IRdsDictionaryInstance;
    // Create a batch for deleting elements
    DictBatch := DictInst.CreateBatch(RdsDictionaryBatchType.Delete);
    If DictBatch.BatchType = RdsDictionaryBatchType.Delete Then
        DelBatch := DictBatch As IRdsDictionaryBatchDelete;
        // Set the end date of value validity for elements
        DelBatch.CloseDate := DateTime.Parse("30.12.2999");
    End If;
    // Delete elements and display result in the console window
    Debug.WriteLine("Number of processed elements: " + DelBatch.Execute.ToString);
    Debug.WriteLine(Number of deleted elements:  + DelBatch.Count.ToString);
    RdsDictObj.Save;
End Sub UserProc;

After executing the example a batch for deleting elements is created, the end date of value validity for elements is set to 30.12.2999. The number of processed and deleted elements is displayed in the console window.

See also:

IRdsDictionaryInstance