ILanerCalculateSerie.ApplyFormulaOnce

Syntax

ApplyFormulaOnce(Transform: IFormulaTransformModel);

Parameters

Transform. The parameters of calculated series calculation.

Description

The ApplyFormulaOnce method executes single calculation of a calculated series by the specified options.

Comments

Series calculation options can be created using ILanerCalculateSerie.CreateTemporaryTransform.

The values that are calculated on calling ApplyFormulaOnce are written to the workbook table cells and supplied with data change flags. For the cell containing the calculated value, the ILanerTable.IsChangedCell property returns True. This is the difference between the ApplyFormulaOnce and the ILanerCalculateSerie.Calculate methods, after the execution of the latter the values are written to the workbook table cells without data change flags supplement.

Example

Executing the example requires a form with the following components: the Button component named Button1, the LanerBox component named LanerBox1, and the UiErAnalyzer component named UiErAnalyzer1. UiErAnalyzer1 is a data source for LanerBox1. A workbook of the time series database that contains the data series should be loaded to UiErAnalyzer.

Add links to the Cubes, Express, ExtCtrls, Forms, Laner, Ms, and Tab system assemblies.

Select one series in the workbook and click on the Button1 button. The following procedure is executed:

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    pSeries: ILanerCalculateSerie;
    pTransformModel: IFormulaTransformModel;
    pTransform: IMsFormulaTransform;
    pSlice: IMsFormulaTransformSlice;
    pSelector: IMsFormulaTransformSelector;
    pFormula: IMsFormula;
    pIdentity: IMsDeterministicTransform;
    pInputSlice: IMsFormulaTransformSlice;
    pTerm: IMsFormulaTerm;
Begin
    pSeries := LanerBox1.SelectedSeries(0As ILanerCalculateSerie;
    pTransformModel := pSeries.CreateTemporaryTransform;
    pTransformModel.AddInputVariable(pSeries.SourceStub);
    pTransform := pTransformModel.Transform As IMsFormulaTransform;
    // Set up transformation
    pSlice := pTransform.Outputs.Item(0).Slices.Add(Null);
    pSelector := pTransform.CreateSelector;
    pSelector.Slice := pSlice;
    pFormula := pTransform.Transform(pSelector);
    pFormula.Kind := MsFormulaKind.Deterministic;
    pFormula.Level := pSeries.Level;
    pIdentity := pFormula.Method As IMsDeterministicTransform;
    pInputSlice := pTransform.Inputs.Add(pSeries.Stub).Slices.Add(Null);
    pTerm := pIdentity.Operands.Add(pInputSlice);
    pIdentity.Expression.AsString := pTerm.TermToInnerText + " + 10";
    // Apply transformation and save data
    pSeries.ApplyFormulaOnce(pTransformModel);
    LanerBox1.ExecuteOperation(LanerBoxOperation.SaveData);
End Sub Button1OnClick;

After executing the example the selected series values are augmented by ten and saved.

See also:

ILanerCalculateSerie