IRdsDictionaryFilterConditions.LoadFrom

Syntax

LoadFrom(Element: Variant);

Parameters

Element. Object, from which filter parameters are loaded.

Description

The LoadFrom method loads XML parameters of the filters collection.

Comments

Use the IRdsDictionaryFilterConditions.SaveTo property to save parameters of the filters collection.

Example

Executing the example requires an MDM repository with the RDS_REPO identifier that contains a non-version MDM dictionary with the DICT identifier. File system must contain the file: C:\BatchFilter.xml with parameters of filters collection in XML format.

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;
    Doc: FreeThreadedDOMDocument60;
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;
    Doc := New FreeThreadedDOMDocument60.Create;
    Doc.load("C:\BatchFilter.xml");
    BatchFilters := DelBatch.Filter;
    BatchFilters.LoadFrom(Doc.documentElement);
    If BatchFilters.Count > 0 Then
        Filter := BatchFilters.Item(0);
        Debug.WriteLine(Remove filter: );
        Debug.WriteLine(    attribute:  + Filter.Attribute.Name);
        Debug.WriteLine(    value:  + Filter.Value);
        BatchFilters.Remove(0);
    End If;
    DelBatch.Execute;
    RdsDictObj.Save;
End Sub UserProc;

After executing the example the batch used to remove elements is created. Parameters of the batch are loaded from XML document: C:\BatchFilter.xml. The first filter of the collection is removed. Then the batch is executed.

See also:

IRdsDictionaryFilterConditions