CreateChildrenIterator(Parent: IRdsDictionaryElement;
FirstElement: Integer;
[CopyFilter: Boolean = True]): IRdsElementsIterator;
CreateChildrenIterator(Parent: Prognoz.Platform.Interop.Rds.IRdsDictionaryElement;
FirstElement: integer;
CopyFilter: boolean): Prognoz.Platform.Interop.Rds.IRdsElementsIterator;
Parent. Element, for which an iterator is created.
FirstElement. Index of the first element.
CopyFilter. Indicates if the parent iterator filter is copied.
The CreateChildrenIterator method creates an iterator used to navigate children for a specified dictionary element.
The CopyFilter parameter is optional in the Fore language, and its default value is True, that is, child iterator uses the same element filter as the parent iterator.
Executing the example requires that the repository contains an MDM repository with the RDS identifier. This repository must contain a table MDM dictionary with the DIC identifier.
Add links to the Metabase, Rds system assemblies.
Sub UserProc;
Var
mb: IMetabase;
rdsKey: Integer;
RdsInst: IRdsDictionaryInstance;
elSearch: IRdsDictionaryElementsSearch;
Dict: IRdsDictionary;
Iter: IRdsElementsIterator;
IterCh: IRdsElementsIterator;
Begin
mb := MetabaseClass.Active;
rdsKey := mb.GetObjectKeyById("RDS");
// Get dictionary, where the search will be run
RdsInst := mb.ItemByIdNamespace("DIC", rdsKey).Open(Null) As IRdsDictionaryInstance;
Dict := RdsInst.Dictionary;
// Create an object for dictionary search
elSearch := RdsInst.CreateSearch;
// Check whether search is performed among the elements obtained from the iterator
If Not elSearch.IsIterator Then
// Create an iterator
Iter := RdsInst.BigElements.CreateIterator(1, 100, Null, Null);
// Set the created iterator for the object that performs search
elSearch.SetIterator(Iter);
// Display iterator elements in the console window
Debug.WriteLine("Iterator elements:");
Iter.First; Iter.Next;
Debug.WriteLine(Iter.Element.Name);
IterCh := Iter.CreateChildrenIterator(Iter.Element, 0, True);
IterCh.First;
While IterCh.Next Do
Debug.WriteLine(" " + IterCh.Element.Name);
End While;
End If;
End Sub UserProc;
After executing the example the console window shows the first dictionary element and its children.
Executing the example requires that the repository contains an MDM repository with the RDS identifier. This repository must contain a table MDM dictionary with the DIC identifier.
Imports Prognoz.Platform.Interop.Rds;
…
[STAThread]
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
rdsKey: uinteger;
RdsInst: IRdsDictionaryInstance;
elSearch: IRdsDictionaryElementsSearch;
Dict: IRdsDictionary;
Iter: IRdsElementsIterator;
IterCh: IRdsElementsIterator;
Begin
mb := Params.Metabase;
rdsKey := mb.GetObjectKeyById("RDS");
// Get dictionary, where the search will be run
RdsInst := mb.ItemByIdNamespace["DIC", rdsKey].Open(Null) As IRdsDictionaryInstance;
Dict := RdsInst.Dictionary;
// Create an object for dictionary search
elSearch := RdsInst.CreateSearch();
// Check whether search is performed among the elements obtained from the iterator
If Not elSearch.IsIterator Then
// Create an iterator
Iter := RdsInst.BigElements.CreateIterator(1, 100, Null, Null);
// Set the created iterator for the object that performs search
elSearch.SetIterator(Iter);
// Display iterator elements in the console window
System.Diagnostics.Debug.WriteLine("Iterator elements:");
Iter.First(); Iter.Next();
System.Diagnostics.Debug.WriteLine(Iter.Element.Name);
IterCh := Iter.CreateChildrenIterator(Iter.Element, 0, True);
IterCh.First();
While IterCh.Next() Do
System.Diagnostics.Debug.WriteLine(" " + IterCh.Element.Name);
End While;
End If;
End Sub;
After executing the example the console window shows the first dictionary element and its children.
See also: