IRdsDictionaryBatch.Filter

Syntax

Filter: IRdsDictionaryFilterConditions;

Description

The Filter property returns a collection of filters, by which elements are selected for a batch.

Comments

By default elements are not filtered. Each filter in the collection is implemented by the IRdsDictionaryFilterCondition interface.

Example

Executing the example requires an MDM repository with the RDS_REPO identifier that contains a non-version MDM dictionary with the DICT identifier. The dictionary contains an attribute of logical type with the ACTUAL identifier.

It is also necessary to add links to the Metabase, Rds and Xml system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    RdrRepoDescr: IMetabaseObjectDescriptor;
    RdsDictObj: IMetabaseObject;
    DictInst: IRdsDictionaryInstance;
    DictBatch: IRdsDictionaryBatch;
    DelBatch: IRdsDictionaryBatchDelete;
    BatchFilters: IRdsDictionaryFilterConditions;
    Filter: IRdsDictionaryFilterCondition;
    Dict: IRdsDictionary;
    Attr: IRdsAttribute;
    Doc: FreeThreadedDOMDocument60;
    Element: IXmlDomElement;
Begin
    mb := MetabaseClass.Active;
    RdrRepoDescr := mb.ItemById("RDS_REP");
    RdsDictObj := mb.ItemByIdNamespace("DICT", RdrRepoDescr.Key).Edit;
    DictInst := RdsDictObj.Open(NullAs IRdsDictionaryInstance;
    DictBatch := DictInst.CreateBatch(RdsDictionaryBatchType.Delete);
    DelBatch := DictBatch As IRdsDictionaryBatchDelete;
    BatchFilters := DelBatch.Filter;
    If BatchFilters.Count > 0 Then
        BatchFilters.Clear;
    End If;
    Dict := DelBatch.Dictionary.Dictionary;
    Attr := Dict.Attributes.FindById("ACTUAL");
    Filter := BatchFilters.Add(Attr);
    Debug.WriteLine(Filter.Attribute.Name);
    Filter.Value := False;
    Doc := New FreeThreadedDOMDocument60.Create;
    Element := Doc.createElement("BatchFilter");
    BatchFilters.SaveTo(Element);
    Doc.appendChild(Element);
    Doc.save("C:\BatchFilter.xml");
    DelBatch.Execute;
    RdsDictObj.Save;
End Sub UserProc;

After executing the example a batch used to delete elements is created. A filter by a value of the ACTUAL attribute is created for the batch. Name of the attribute is displayed in the console window. The filter is saved in the XML document: C:\BatchFilter.xml. Then the batch is executed.

See also:

IRdsDictionaryBatch