ICubeSegmentContainer.GetAllSegments

Syntax

GetAllSegments: ICubeSegments;

Description

The GetAllSegments method returns the collection of segments stored in a container.

Example

Executing the example requires that the repository contains a standard cube with the STD_CUBE identifier. The list of cube dimensions includes a dimension with the COUNTRY identifier. A segment container is also connected to the cube.

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

Sub UserProc;
Var
    Mb: IMetabase;
    Cube: IStandardCube;
    SegContainer: ICubeSegmentContainer;
    Segments: ICubeSegments;
    Segment: ICubeSegment;
    Factory: IDimSelectionSetFactory;
    DimSS: IDimSelectionSet;
    DimS: IDimSelection;
Begin
    Mb := MetabaseClass.Active;
    Cube := Mb.ItemById("STD_CUBE").Bind As IStandardCube;
    // Get cube segment container
    SegContainer := Cube.SegmentContainer;
    // List of all segments
    Segments := SegContainer.GetAllSegments;
    Segment := Segments.Item(0);
    Factory := New DimSelectionSetFactory.Create;
    DimSS := Factory.CreateDimSelectionSet;
    // Get segment selection
    SegContainer.ReadSelectionSet(Segment, DimSS);
    // Change segment selection
    DimS := DimSS.FindById("COUNTRY");
    DimS.DeselectAll;
    DimS.SelectElement(1False);
    SegContainer.WriteSelectionSet(Segment, DimSS);
End Sub UserProc;

After executing the example the segment is obtained from the segment container used by the cube. Segment selection is obtained and changed.

See also:

ICubeSegmentContainer