CreateBatch(BatchType: RdsDictionaryBatchType): IRdsDictionaryBatch;
CreateBatch(BatchType: Prognoz.Platform.Interop.Rds.RdsDictionaryBatchType): Prognoz.Platform.Interop.Rds.IRdsDictionaryBatch;
BatchType. Type of elements batch.
The CreateBatch method creates elements batch of the MDM dictionary.
The batch is used to execute any operations over all elements in the batch simultaneously.
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(Null) As 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.
The requirements and result of the Fore.NET Example execution match with those in the Fore Example.
Imports Prognoz.Platform.Interop.Rds;
…
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
RdsDictObj: IMetabaseObject;
DictInst: IRdsDictionaryInstance;
DictBatch: IRdsDictionaryBatch;
DelBatch: IRdsDictionaryBatchDelete;
Begin
// Get current repository
mb := Params.Metabase;
// Get dictionary
RdsDictObj := mb.ItemById["DICT"].Edit();
DictInst := RdsDictObj.Open(Null) As IRdsDictionaryInstance;
// Create a batch for deleting elements
DictBatch := DictInst.CreateBatch(RdsDictionaryBatchType.rdbtDelete);
If DictBatch.BatchType = RdsDictionaryBatchType.rdbtDelete 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
System.Diagnostics.Debug.WriteLine("Number of processed elements: " + DelBatch.Execute().ToString());
System.Diagnostics.Debug.WriteLine("Number of deleted elements: " + DelBatch.Count.ToString());
RdsDictObj.Save();
End Sub;
See also: