TimeForwardLag: Integer;
The TimeForwardLag property determines the value, to which selection is an increase forward (forward lag) for the specified calendar level.
Selection increase is used to extract additional values, which may be required to calculate formulas. The actual calculation will be made according to the selection specified in the ICubeInstanceDestination.Execute method.
Executing the example requires that the repository contains a standard cube with the STD_CUBE identifier. The cube facts dimension has at least two elements: the first element is linked to the data source field, the second element is not linked. Cube structure contains a calendar dimension.
Add links to the Cubes, Db, Dimensions and Metabase system assemblies.
Sub UserProc;
Var
MB: IMetabase;
MObj: IMetabaseObject;
StdCube: IStandardCube;
StdCubeDest: IStandardCubeDestination;
CalcBind: IStandardCubeCalculatedFactBinding;
Relation: IStandardCubeRelation;
Begin
MB := MetabaseClass.Active;
MObj := MB.ItemById("STD_CUBE").Edit;
StdCube := MObj As IStandardCube;
StdCubeDest := StdCube.Destinations.Item(0);
//Create a relation
Relation := StdCubeDest.Relations.Add;
Relation.Id := "NEXT_VALUE";
Relation.Name := "NEXT_VALUE";
//Relation formula for calendar dimension
Relation.Relation(StdCubeDest.Dimensions.Calendar).AsString := "T.NEXT";
//Binding of the second (calculated) fact
CalcBind := StdCubeDest.CalcBindings.Binding(3) As IStandardCubeCalculatedFactBinding;
CalcBind.Formula.AsString := "@[1]-NEXT_VALUE[@[1]]";
//Set lag for calculated factor
CalcBind.TimeLagLevel := DimCalendarLevel.Year;
CalcBind.TimeForwardLag := 2;
MObj.Save;
End Sub UserProc;
Imports Prognoz.Platform.Interop.Cubes;
Imports Prognoz.Platform.Interop.Db;
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Metabase;
Public Shared Sub Main1(Params: StartParams);
Var
MB: IMetabase;
MObj: IMetabaseObject;
StdCube: IStandardCube;
StdCubeDest: IStandardCubeDestination;
CalcBind: IStandardCubeCalculatedFactBinding;
Relation: IStandardCubeRelation;
Begin
MB := Params.Metabase;
MObj := MB.ItemById["STD_CUBE"].Edit();
StdCube := MObj As IStandardCube;
StdCubeDest := StdCube.Destinations.Item[0];
//Create a relation
Relation := StdCubeDest.Relations.Add();
Relation.Id := "NEXT_VALUE";
Relation.Name := "NEXT_VALUE";
//Relation formula for calendar dimension
Relation.Relation[StdCubeDest.Dimensions.Calendar].AsString := "T.NEXT";
//Binding of the second (calculated) fact
CalcBind := StdCubeDest.CalcBindings.Binding[2] As IStandardCubeCalculatedFactBinding;
CalcBind.Formula.AsString := "@[1]-NEXT_VALUE[@[1]]";
//Set lag for calculated factor
CalcBind.TimeLagLevel := DimCalendarLevel.dclYear;
CalcBind.TimeForwardLag := 2;
MObj.Save();
End Sub;
On executing the example a relation is created in the cube, and a calculated fact is set up. The relation will extract the next value towards the current calculation point by calendar dimension. The calculation fact, using the relation, will calculate the difference between the current and the next value. The lag will be also set for the calculated fact, according to which selection will increase on extracting values for calculation.
See also: