IRdsDictionaryFilterConditions.LoadFrom

Fore Syntax

LoadFrom(Element: Variant);

Fore.NET Syntax

LoadFrom(Element: object);

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.

Fore 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.

Fore.NET Example

The requirements and result of the Fore.NET Example execution match with those in the Fore Example.

Imports Prognoz.Platform.Interop.MsXml2;
Imports Prognoz.Platform.Interop.Rds;

Public Shared Sub Main(Params: StartParams);
Var
    mb: IMetabase;
    RdrRepoDescr: IMetabaseObjectDescriptor;
    RdsDictObj: IMetabaseObject;
    DictInst: IRdsDictionaryInstance;
    DictBatch: IRdsDictionaryBatch;
    DelBatch: IRdsDictionaryBatchDelete;
    BatchFilters: IRdsDictionaryFilterConditions;
    Filter: IRdsDictionaryFilterCondition;
    Doc: FreeThreadedDOMDocument60;
Begin
    mb := Params.Metabase;
    RdrRepoDescr := mb.ItemById["RDS_REP"];
    RdsDictObj := mb.ItemByIdNamespace["DICT", RdrRepoDescr.Key].Edit();
    DictInst := RdsDictObj.Open(NullAs IRdsDictionaryInstance;
    DictBatch := DictInst.CreateBatch(RdsDictionaryBatchType.rdbtDelete);
    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];
        System.Diagnostics.Debug.WriteLine("Remove filter: ");
        System.Diagnostics.Debug.WriteLine("    attribute: " + Filter.Attribute.Name);
        System.Diagnostics.Debug.WriteLine("    value: " + Filter.Value);
        BatchFilters.Remove(0);
    End If;
    DelBatch.Execute();
    RdsDictObj.Save();
End Sub;

See also:

IRdsDictionaryFilterConditions