IMetabaseObjectDescriptors.Add

Syntax

Add: IMetabaseObjectDescriptor;

Add(): Prognoz.Platform.Interop.Metabase.IMetabaseObjectDescriptor;

Description

The Add method adds the object description to the collection.

Comments

In the following implementation this method is available only for the manipulation of the collection of objects that are copied with the time series database.

Example

Executing the example requires that the repository contains a time series database with the FC identifier.

Add links to the Cubes, Metabase system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    RubUpdateEx: ICubeMetaUpdateEx;
    Rub: IRubricator;
    Progress: IMetabaseUpdateProgress;
    CrInfo: IMetabaseObjectCreateInfo;
    s: string;
    ObjectsF: IMetabaseObjectDescriptors;
    ObjF: IMetabaseObjectDescriptor;
    i: Integer;
Begin
    mb := MetabaseClass.Active;
    RubUpdateEx := New CubeMetaUpdateClass.Create As ICubeMetaUpdateEx;
    Rub := mb.ItemById("FC").Bind As IRubricator;
    RubUpdateEx.Rubricator := Rub;
    RubUpdateEx.Metabase := Mb;
    CrInfo := RubUpdateEx.CreateInfo;
    CrInfo.Parent := mb.Root;
    s := Mb.GenerateId("FC_COPY");
    CrInfo.Id := s;
    CrInfo.Name := s;
    RubUpdateEx.CopyExtraObjects := True;
    ObjectsF := RubUpdateEx.ObjectsFilter;
    ObjF := Rub.Container(RubricatorContainerType.Data);
    ObjectsF.Add(ObjF);
    For i := 0 To ObjF.Children.Count - 1 Do
    ObjectsF.Add(ObjF.Children.Item(i));
    End For;
    RubUpdateEx.RdsDatabase := Rub.Database;
    RubUpdateEx.Apply(Progress);
End Sub UserProc;
Imports Prognoz.Platform.Interop.Cubes;
 
Public Shared Sub Main(Params: StartParams);
Var
    mb: IMetabase;
    RubUpdateEx: ICubeMetaUpdateEx;
    Rub: IRubricator;
    Progress: IMetabaseUpdateProgress;
    CrInfo: IMetabaseObjectCreateInfo;
    s: string;
    ObjectsF: IMetabaseObjectDescriptors;
    ObjF: IMetabaseObjectDescriptor;
    i: Integer;
Begin
    mb := Params.Metabase;
    RubUpdateEx := 
New CubeMetaUpdateClass.Create() As ICubeMetaUpdateEx;
    Rub := mb.ItemById[
"FC"].Bind() As IRubricator;
    RubUpdateEx.Rubricator := Rub;
    RubUpdateEx.Metabase := Mb;
    CrInfo := RubUpdateEx.CreateInfo;
    CrInfo.Parent := mb.Root;
    s := mb.GenerateId(
"FC_COPY",0);
    CrInfo.Id := s;
    CrInfo.Name := s;
    RubUpdateEx.CopyExtraObjects := 
True;
    ObjectsF := RubUpdateEx.ObjectsFilter;
    ObjF := Rub.Container[RubricatorContainerType.rucontData];
    ObjectsF.Add(ObjF);
    
For i := 0 To ObjF.Children.Count - 1 Do
    ObjectsF.Add(ObjF.Children.Item[i]);
    
End For;
    RubUpdateEx.RdsDatabase := Rub.Database;
    RubUpdateEx.Apply(Progress);
End Sub;

After executing the example, the FC time series database is copied to the repository root folder. Identifier of the copy - FC_COPY. Only the nested objects, the description of which is contained in the ObjectsF collection.

See also:

IMetabaseObjectDescriptors