ILanerCalculateSerie.ApplyFormulaOnce

Syntax

ApplyFormulaOnce(Transform: IFormulaTransformModel);

Parameters

Transform. The parameters of calculated series calculation.

Description

The ApplyFormulaOnce method performs a one time calculation of a calculated series according to the set options.

Comments

The series calculation parameters 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 Button1 button, the LanerBox component with the LanerBox1 identifier, and the UiErAnalyzer component used as a data source for LanerBox. The time series database workbook, that contains the data series must be loaded to UiErAnalyzer. Add links to the Ms and Cubes 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;
// Configuring the 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";
// The application of the transformation and the saving of the 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