IAutoCubeInstance.UpdateFromSource

Syntax

UpdateFromSource(

Selection: IDimSelectionSet;

[Options: AutoCubeUpdateOption = 0;]

[SourceParams: IMetabaseObjectParamValues = Null]);

Parameters

Selection - elements selection, which data must be updated.

Options - parameter that determines data update method.

SourceParams - parameter values, with which the source cube opens during an update. It is relevant if the source cube has any parameters.

Description

The UpdateFromSource method updates automatic cube data from the source cube according to the specified parameters.

Example

Executing the example requires that the repository contains a modeling container with the Model_Space identifier. The container contains the Var_1 variable that is set up to load data from the source. The source has one parameter that accepts input real numbers. Add links to the Metabase, Cubes, Dimensions, and Ms system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    MObj, CubeSource: IMetabaseObject;
    ParamV: IMetabaseObjectParamValues;
    MsVar: IMsVariable;
    Cube: IAutoCube;
    CubeInst: ICubeInstance;
    Dest: ICubeInstanceDestination;
    DimSS: IDimSelectionSet;
Begin
    MB := MetabaseClass.Active;
    MObj := MB.ItemByIdNamespace(
"Var_1", MB.ItemById("Model_Space").Key).Edit;
    MsVar := MObj 
As IMsVariable;
    
//Get variable cube
    Cube := MsVar.Cube;
    
//Get source cube parameters
    CubeSource := (Cube.Source.Cube.Cube As IMetabaseObject).Bind;
    ParamV := CubeSource.ParamValues;
    ParamV.Item(
0).Value := 3.5;
    CubeInst := (Cube 
As IMetabaseObject).Open(NullAs ICubeInstance;
    Dest := CubeInst.Destinations.DefaultDestination;
    
//Create a cube selection
    DimSS := Dest.CreateDimSelectionSet;
    
//Select all elements
    DimSS.Item(0).SelectAll;
    DimSS.Item(
1).SelectAll;
    
//Load data
    ((Cube As IMetabaseObject).Open(NullAs IAutoCubeInstance).UpdateFromSource(DimSS,
    AutoCubeUpdateOption.None, ParamV);
    MObj.Save;
End Sub UserProc;

After executing the example data from the source specified for the modeling variable is loaded into the modeling variable. Data is loaded in accordance with the specified selection. The number 3.5 is passed as a value for data source parameter.

See also:

IAutoCubeInstance