Hypercubes
Defining a hypercube
To define your hypercube, you access it through the Properties property HyperCubeDef.
Example: Hypercube definition
var cubeDef = myTable.Properties.HyperCubeDef;
Using hypercubes for calculations
To use hypercubes for calculations you must first specify valid dimensions and measures. Then you add the dimensions and measures to the hypercube.
Creating dimensions and measures
There are two ways of creating Dimensionsand Measures:
- Locally in the generic object.
- Added to the application library for reuse in other generic objects.
Example: Create a local or inline Dimension
var myInlineDimension = new HyperCubeDimensionqDef { FieldDefs = new[] { "myDimension" } };
Example: Create an application or library Dimension
var myLibraryDimension = application.CreateDimension(); myLibraryDimension.SuspendLayout(); myLibraryDimension.Properties.Dim.FieldDefs = new[] {"myDimension"}; myLibraryDimension.ResumeLayout();
Example: Create a local or inline measure
var myInlineMeasure = new HyperCubeMeasureqDef {Def = "=Sum(value)"};
Example: Create an application or library Measure
var myLibraryMeasure = application.CreateMeasure(); myLibraryMeasure.SuspendLayout(); myLibraryMeasure.Properties.Measure.Def = "=Sum(value)"; myLibraryMeasure.ResumeLayout();
Adding dimensions and measures to the hypercube
When you have created your Dimensions and Measures you can add them to the hypercube.
Example: Add a Dimension to the hypercube
cubeDef.Dimensions = new List<HyperCubeDimensionDef> { new HyperCubeDimensionDef {Def = myInlineDimension}, new HyperCubeDimensionDef {LibraryId = myLibraryDimension.Info.Id} };
Example: Add a Measure to the hypercube
cubeDef.Measures = new List<HyperCubeMeasureDef> { new HyperCubeMeasureDef {Def = myInlineMeasure}, new HyperCubeMeasureDef {LibraryId = myLibraryMeasure.Info.Id} };