Filter: IRdsDictionaryFilterConditions;
Filter: Prognoz.Platform.Interop.Rds.IRdsDictionaryFilterConditions;
The property is read-only.
The Filter property returns a collection of filters, by which elements are selected for a batch.
By default elements are not filtered. Each filter in the collection is implemented by the IRdsDictionaryFilterCondition interface.
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(Null) As 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.
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;
Dict: IRdsDictionary;
Attr: IRdsAttribute;
Doc: FreeThreadedDOMDocument60;
Element: IXmlDomElement;
Begin
mb := Params.Metabase;
RdrRepoDescr := mb.ItemById["RDS_REP"];
RdsDictObj := mb.ItemByIdNamespace["DICT", RdrRepoDescr.Key].Edit();
DictInst := RdsDictObj.Open(Null) As IRdsDictionaryInstance;
DictBatch := DictInst.CreateBatch(RdsDictionaryBatchType.rdbtDelete);
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);
System.Diagnostics.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;
See also: