IRdsDictionaryBatchUpdate.SetData

Syntax

SetData(Data: IRdsDictionaryElementData);

Parameters

Data. Updated data.

Description

The SetData method sets data to be updated.

Comments

Use the IRdsDictionaryElements.CreateData method to get MDM dictionary data.

Example

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

Add links to the Metabase, Rds system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    RdsDictObj: IMetabaseObject;
    RdsDict: IRdsDictionary;
    DictInst: IRdsDictionaryInstance;
    Batch: IRdsDictionaryBatchUpdate;
    Attr: IRdsAttribute;
    data: IRdsDictionaryElementData;
    Filters: IRdsDictionaryFilterConditions;
Begin
    // Get current repository
    mb := MetabaseClass.Active;
    // Get dictionary
    RdsDictObj := mb.ItemById("DICT_COPY1").Edit;
    DictInst := RdsDictObj.Open(NullAs IRdsDictionaryInstance;
    
// Create package to update elements
    batch := DictInst.CreateBatch(RdsDictionaryBatchType.Update) As IRdsDictionaryBatchUpdate;
    data := DictInst.Elements.CreateData;
    RdsDict := RdsDictObj 
As IRdsDictionary;
    
// Select dictionary attribute
    Attr := RdsDict.Attributes.FindById("NAME");
    
// Filter dictionary elements by selected attribute
    Filters := batch.Filter;
    
If Filters.FindByAttribute(Attr) <> Null Then
        Filters.Clear;
    
End If;
    
// Determine new value for elements by selected attribute
    data.Value(data.AttributeIndex(Attr.Key)) := "Element " + DateTime.Now.ToString;
    
// Refresh data
    batch.SetData(data);
    batch.Execute;
End Sub UserProc;

After executing the example names of all elements in the DICT dictionary are changed.

See also:

IRdsDictionaryBatchUpdate