IMobilePublishCube.SetSelection

Fore Syntax

SetSelection(Value: );

Fore.NET Syntax

SetSelection(Value: Prognoz.Platform.Interop.Dimensions.);

Parameters

Value. Selection of cube dimension elements.

Description

The SetSelection method sets the specified selection for the cube dimension elements.

Comments

To add elements to the selection, use the IMobilePublishCube.AddSelection method.

Fore Example

Executing the example requires that the repository must contain the mobile application with the MA_PUB identifier. Add links to the Metabase, Mobile, Dimensions, Cube system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    Mobile: IMobileApplication;
    Publicator: IMobileApplicationPublicator;
    MaPubObs: IMobileApplicationPublishObjects;
    i: Integer;
    MaPubObj: IMobileApplicationPublishObject;
    PubObj: IMobilePublishObject;
    CubePubObj: IMobilePublishCube;
    s: String;
    Cube: ICubeInstance;
    DefDest: ICubeInstanceDestination;
    SelSet: IDimSelectionSet;
    DimSel: IDimSelection;
    j: Integer;
    res: MobilePublishObjectResult;
Begin
    mb := MetabaseClass.Active;
    // Get the mobile application 
    Mobile := mb.ItemById("MA_PUB").Bind As IMobileApplication;
    // Create a mobile application publicator 
    Publicator := Mobile.CreatePublicator;
    // Get the mobile application objects
    MaPubObs := Publicator.Items;
    For i := 0 To MaPubObs.Count - 1 Do
        MaPubObj := MaPubObs.Item(i);
        // Select cubes among the objects
        If MaPubObj.Type = MobilePublishObjectType.Cube Then
            PubObj := MaPubObj.PublishObject;
            CubePubObj := PubObj As IMobilePublishCube;
            // Display data on the cube in the console window
            s := PubObj.Object.Name + " (" + PubObj.Object.Id + ")";
            Debug.WriteLine("Cube: " + s).
            Cube := PubObj.Object.Open(NullAs ICubeInstance;
            DefDest := Cube.Destinations.DefaultDestination;
            // Get an empty selection
            SelSet := DefDest.CreateDimSelectionSet;
            // Select the first dimension elements
            For j := 0 To SelSet.Count - 1 Do
                DimSel := SelSet.Item(j);
                DimSel.SelectElement(0False);
            End For;
            // Set a new selection of elements
            CubePubObj.SetSelection(SelSet);
            // Define the publishing path
            PubObj.ExportPath := "C:\" + PubObj.Object.Id + ".zip";
            // Publishing cube
            res := PubObj.Publish;
            // Display the result in the console window
            If (res As integer) = 0 Then
                Debug.WriteLine("Publishing was successful").
                Debug.WriteLine("    Publishing path: " + PubObj.ExportPath);
            Else
                Debug.WriteLine("Error occurred on publishing").
            End If;
        End If;
    End For;
End Sub UserProc;

Example execution result: the selection of dimensions elements for all cubes from the mobile application is changed; the cubes are published and the publishing results are displayed in the console window.

Fore.NET Example

Executing the example requires that the repository contains a mobile application with the MA_PUB identifier.

Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Mobile;
Imports Prognoz.Platform.Interop.Dimensions;

[STAThread]
Public Shared Sub Main(Params: StartParams);
Var
    mb: IMetabase;
    Mobile: IMobileApplication;
    Publicator: IMobileApplicationPublicator;
    MaPubObs: IMobileApplicationPublishObjects;
    i: Integer;
    MaPubObj: IMobileApplicationPublishObject;
    PubObj: IMobilePublishObject;
    CubePubObj: IMobilePublishCube;
    s: String;
    Cube: ICubeInstance;
    DefDest: ICubeInstanceDestination;
    SelSet: IDimSelectionSet;
    DimSel: IDimSelection;
    j: Integer;
    res: MobilePublishObjectResult;
Begin
    mb := Params.Metabase;
    // Get the mobile application 
    Mobile := mb.ItemById["MA_PUB"].Bind() As IMobileApplication;
    // Create a mobile application publicator 
    Publicator := Mobile.CreatePublicator();
    // Get the mobile application objects
    MaPubObs := Publicator.Items;
    For i := 0 To MaPubObs.Count - 1 Do
        MaPubObj := MaPubObs.Item[i];
        // Select cubes among the objects
        If MaPubObj.Type = MobilePublishObjectType.mpotCube Then
            PubObj := MaPubObj.PublishObject;
            CubePubObj := PubObj As IMobilePublishCube;
            // Display data on the cube in the console window
            s := PubObj.Object.Name + " (" + PubObj.Object.Id + ")";
            System.Diagnostics.Debug.WriteLine("Cube: " + s).
            Cube := PubObj.Object.Open(NullAs ICubeInstance;
            DefDest := Cube.Destinations.DefaultDestination;
            // Get an empty selection
            SelSet := DefDest.CreateDimSelectionSet();
            // Select the first dimension elements
            For j := 0 To SelSet.Count - 1 Do
                DimSel := SelSet.Item[j];
                DimSel.SelectElement(0False);
            End For;
            // Set a new selection of elements
            CubePubObj.SetSelection(SelSet);
            // Define the publishing path
            PubObj.ExportPath := "C:\" + PubObj.Object.Id + ".zip";
            // Publishing cube
            res := PubObj.Publish(Null);
            // Display the result in the console window
            If (res As integer) = 0 Then
                System.Diagnostics.Debug.WriteLine("Publishing was successful").
                System.Diagnostics.Debug.WriteLine("    Publishing path: " + PubObj.ExportPath).
            Else
                System.Diagnostics.Debug.WriteLine("Error occurred on publishing").
            End If;
        End If;
    End For;
End Sub;

Example execution result: the selection of dimensions elements for all cubes from the mobile application is changed; the cubes are published and the publishing results are displayed in the console window.

See also:

IMobilePublishCube