Source: IAutoCubeSource;
The Source property returns parameters of data source cube for automatic cube.
Executing the example requires that the repository contains an automatic cube with the AUTO_CUBE identifier and a standard cube with the STD_CUBE identifier. Both cubes have a calendar dimension in the structure that is built based on one calendar dictionary. Cubes can also have other equal dimensions.
Add links to the Cubes, Dimensions and Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
AutoCube: IAutoCube;
Source: IAutoCubeSource;
CubeSource: ICubeModel;
SourceDims: IStandardCubeDimensions;
SourceDim: IStandardCubeDimension;
Dims: IAutoCubeDimensions;
Dim: IAutoCubeDimension;
DimsFix: IAutoCubeSourceFixInfo;
DimFix: IAutoCubeSourceDimensionFix;
Begin
MB := MetabaseClass.Active;
// Automatic cube
AutoCube := MB.ItemById("AUTO_CUBE").Edit As IAutoCube;
// Cube that will be a data source for automatic cube
CubeSource := MB.ItemById("STD_CUBE").Bind As ICubeModel;
// Specify and set up data source
Source := AutoCube.Source;
Source.Cube := CubeSource.Destinations.DefaultDestination;
SourceDims := Source.Cube.Dimensions As IStandardCubeDimensions;
Source.Calendar := SourceDims.Calendar.Dimension;
Source.Transparent := True;
// Link between automatic cube dimensions and data source dimensions
Dims := AutoCube.Dimensions;
For Each Dim In Dims Do
SourceDim := SourceDims.FindByKey((Dim.Dimension As IMetabaseObject).Key);
Dim.Method := CubeLoaderMapMethod.ByIndex;
Dim.MapDimension := SourceDim.Dimension;
Dim.MapIndex := SourceDim.Dimension.Indexes.PrimaryIndex;
End For;
// Fix data source dimensions that are absent in automatic cube
DimsFix := Source.FixInfo;
For Each DimFix In DimsFix Do
DimFix.Selection.SelectElement(0, False);
End For;
// Save changes
(AutoCube As IMetabaseObject).Save;
End Sub UserProc;
After executing the example a data source is determined for the automatic cube. A calendar dimension and display version are selected, attribute of getting data from source is set. A link between shared dimensions is set up, and the first element is fixed in the source dimensions that are absent in the automatic cube.
See also: