ICubeSegmentContainer.Database

Syntax

Database: IDatabase;

Description

The Database property determines the database, which will store segment tables.

Comments

If the property is not determined, the database is used that is set for default repository.

Example

Executing the example requires that the repository contains a database with the DB identifier and a folder with the STD_CUBE identifier.

Add links to the Cubes, Db, Dimensions and Metabase system assemblies.

Sub UserProc;
Var
    Mb: IMetabase;
    CrInfo: IMetabaseObjectCreateInfo;
    MDesc: IMetabaseObjectDescriptor;
    SegContainer: ICubeSegmentContainer;
    StdCube: IStandardCube;
    Dimensions: IStandardCubeDimensions;
    Dimension: IStandardCubeDimension;
    SegDims: ICubeSegmentDimensions;
Begin
    Mb := MetabaseClass.Active;
    // Basic information for creating a new segment container
    CrInfo := Mb.CreateCreateInfo;
    CrInfo.Parent := Mb.ItemById("FOLDER_FOR_SEGMENTS_CONTAINERS");
    CrInfo.ClassId := MetabaseObjectClass.KE_CLASS_CUBE_SEGMENT_CONTAINER;
    CrInfo.Id := "SEG_CONTAINER";
    CrInfo.KeepEdit := True;
    // Create a segment container
    MDesc := Mb.CreateObject(CrInfo);
    SegContainer := MDesc As ICubeSegmentContainer;
    // Set up segment container
    SegContainer.Database := Mb.ItemById("DB").Bind As IDatabase;
    SegDims := SegContainer.Dimensions;
    // Add all cube dimensions to the list of dimensions
    StdCube := Mb.ItemById("STD_CUBE").Bind As IStandardCube;
    Dimensions := StdCube.Destinations.Item(0).Dimensions;
    For Each Dimension In Dimensions Do
        If IsNull(SegDims.FindByDim(Dimension.Dimension)) Then
            SegDims.Add(Dimension.Dimension);
        End If;
    End For;
    // Save changes
    (SegContainer As IMetabaseObject).Save;
    Debug.WriteLine("---New---");
    Debug.WriteLine(MDesc.Name + '(' + MDesc.Id + ')');
    Debug.WriteLine("Dimension count: " + SegDims.Count.ToString);
End Sub UserProc;

After executing the example a new segment container is created in the hidden system folder. A database to store tables is determined for the container, and all dimensions of the specified cube will be added to the list of dimensions. The development environment console will display information about the specified segment container.

See also:

ICubeSegmentContainer