ILanerCalculateSerie.Calculate

Syntax

Calculate;

Description

The Calculate method calculates the calculated series.

Example

Executing the example requires a form with the Button1 button, the TabSheetBox component and the UiErAnalyzer component named UiErAnalyzer1 that is a data source for TabSheetBox. The UiErAnalyzer1 must have loaded working area of a time series database the data table of which has more than one data series.

Click the button to start executing this example.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);

Var

Laner: Ilaner;

UsingSerie, UsingSerie2: ILanerSerie;

NewSerie: ILanerCalculateSerie;

Str: String;

Trasss: IFormulaTransformModel;

ms: IMsFormulaTransform;

TransformVar: IMsFormulaTransformVariable;

Coord: IMsFormulaTransformCoord;

Slice: IMsFormulaTransformSlice;

selector: IMsFormulaTransformSelector;

Formula: IMsFormula;

Det: IMsDeterministicTransform;

Term1, Term2: IMsFormulaTerm;

Begin

Laner := UiErAnalyzer1.ErAnalyzer.Laner;

Laner.BeginUpdate;

UsingSerie := Laner.Series.Item(0) As ILanerSerie;

UsingSerie2 := Laner.Series.Item(1) As ILanerSerie;

Str := "Summ_(" + UsingSerie.Name + " , " + UsingSerie2.Name + ")";

NewSerie := Laner.Series.AddCalculateSerie(Str);

Trasss := NewSerie.Transform;

Trasss.AddInputVariable(UsingSerie.Stub);

Trasss.AddInputVariable(UsingSerie2.Stub);

ms := Trasss.Transform As IMsFormulaTransform;

TransformVar := ms.Outputs.Item(0);

Coord := ms.CreateCoord(TransformVar);

Slice := TransformVar.Slices.Add(Null);

Selector := ms.CreateSelector;

Selector.Slice := Slice;

Formula := ms.Transform(Selector);

Formula.Kind := MsFormulaKind.Deterministic;

Formula.Level := DimCalendarLevel.Year;

Det := Formula.Method As IMsDeterministicTransform;

TransformVar := ms.Inputs.Add(UsingSerie.Stub);

Slice := TransformVar.Slices.Add(Null);

TransformVar := ms.Inputs.Add(UsingSerie.Stub);

Slice := TransformVar.Slices.Add(Null);

Term1 := Det.Operands.Add(Slice);

TransformVar := ms.Inputs.Add(UsingSerie2.Stub);

Slice := TransformVar.Slices.Add(Null);

Term2 := Det.Operands.Add(Slice);

Det.Expression.AsString := Term1.TermToInnerText + " + " + Term2.TermToInnerText;

NewSerie.Calculate;

Laner.EndUpdate;

End Sub Button1OnClick;

After executing the example the new calculated series which is the sum of the two first series data is added.

See also:

ILanerCalculateSerie