LevelTo: IDimLevelInstance;
LevelTo: Prognoz.Platform.Interop.Dimensions.IDimLevelInstance;
The LevelTo property determines the level, for which shift is executed.
To determine the level, by which shift is executed, use the IPrxCalculatedPointDimensionShift.Level property.
Executing the example requires that the repository contains a regular report with the DOCUMENT identifier that contains a text sheet. A data source of the regular report contains a dimension with the D_SEP identifier.
Add links to the Dimensions, Metabase, Report system assemblies.
Sub UserProc;
Var
MB: IMetabase;
MObj: IMetabaseObject;
Report: IPrxReport;
DataSource: IPrxDataSource;
SliceDims: IPrxSliceDimensions;
Points: IPrxCalculatedPoints;
Point, ParentPoint: IPrxCalculatedPoint;
PointShift: IPrxCalculatedShiftedPoint;
PointDimShift: IPrxCalculatedPointDimensionShift;
Dim: IDimInstance;
DimLevels: IDimLevelsInstance;
DimLevel: IDimLevelInstance;
Begin
MB := MetabaseClass.Active;
MObj := MB.ItemById("DOCUMENT").Edit;
Report := MObj As IPrxReport;
DataSource := Report.DataSources.Item(0);
SliceDims := DataSource.Slices.Item(0).Dimensions;
Dim := SliceDims.FindById("D_SEP").Dimension;
Points := DataSource.Points;
Points.Clear;
// Calculated point:
Point := Points.Add;
Point.Name := "Point_1";
Point.CalculateValue;
// Shift in calculated point:
PointShift := Point As IPrxCalculatedShiftedPoint;
ParentPoint := PointShift.ParentPoint;
DimLevels:=Dim.Levels;
DimLevel:=DimLevels.Item(DimLevels.Count-1);
PointDimShift := PointShift.Shift(Dim);
PointDimShift.LevelTo := DimLevel;
Debug.WriteLine("Dimension, for which shift is executed: "
+ PointDimShift.Dimension.Name);
Points.CalculateValues;
(Report As IMetabaseObject).Save;
End Sub UserProc;
After executing the example:
A calculated point with the shift by the selected dimension level is added.
The console window displays name of the dimension, by which shift is executed.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Dimensions;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
MObj: IMetabaseObject;
Report: IPrxReport;
DataSource: IPrxDataSource;
SliceDims: IPrxSliceDimensions;
Points: IPrxCalculatedPoints;
Point, ParentPoint: IPrxCalculatedPoint;
PointShift: IPrxCalculatedShiftedPoint;
PointDimShift: IPrxCalculatedPointDimensionShift;
Dim: IDimInstance;
DimLevels: IDimLevelsInstance;
DimLevel: IDimLevelInstance;
Begin
MB := Params.Metabase;
MObj := MB.ItemById["DOCUMENT"].Edit();
Report := MObj As IPrxReport;
DataSource := Report.DataSources.Item[0];
SliceDims := DataSource.Slices.Item[0].Dimensions;
Dim := SliceDims.FindById("D_SEP").Dimension;
Points := DataSource.Points;
Points.Clear();
// Calculated point:
Point := Points.Add();
Point.Name := "Point_1";
Point.CalculateValue(True);
// Shift in calculated point:
PointShift := Point As IPrxCalculatedShiftedPoint;
ParentPoint := PointShift.ParentPoint;
DimLevels:=Dim.Levels;
DimLevel:=DimLevels.Item[DimLevels.Count-1];
PointDimShift := PointShift.Shift[Dim];
PointDimShift.LevelTo := DimLevel;
System.Diagnostics.Debug.WriteLine("Dimension, for which shift is executed: "
+ PointDimShift.Dimension.Name);
Points.CalculateValues();
(Report As IMetabaseObject).Save();
End Sub;
See also: