IMsFormula.Execute

Syntax

Execute(Calculation: IMsMethodCalculation;

        Coord: IMsFormulaTransformCoord;

        Callback: IMsFormulaExecuteCallback);

Parameters

Calculation. It determines parameters that are required for method calculation.

Coord. It determines coordinate's parameters in the variable, by which calculation is executed.

Callback. It determines an object for feedback on method calculation.

Description

The Execute method calculates the method.

Example

Executing the example requires that the repository contains a form with the Button1 button and the Memo component named Memo1. The Memo1 component must contain model parameters as an XML code.

The example is a handler of the OnClick event for the Button1 button.

Add links to the Metabase and Ms system assemblies.

Class MsCallbackimpl:Object, IMsFormulaExecuteCallback
    Sub ResultMatrix(Matrix: IMatrix; Conditions: IOrmConditions);
    Var
        Ite: IMatrixIterator;
    Begin
        Debug.WriteLine("Execution.");
        Ite := Matrix.CreateIterator;
        Ite.Move(IteratorDirection.First);
        While Ite.Valid Do
            Debug.WriteLine(Ite.Value);
            Ite.Move(IteratorDirection.Next);
        End While;
    End Sub ResultMatrix;
End Class MsCallbackimpl;

Class TestForm: Form
    Button1: Button;
    Memo1: Memo;
    Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
    Var
        ActiveMetabase: IMetabase;
        Transform: IMsFormulaTransform;
        TransformVar: IMsFormulaTransformVariable;
        Coord: IMsFormulaTransformCoord;
        Slice: IMsFormulaTransformSlice;
        Selector: IMsFormulaTransformSelector;
        Formula: IMsFormula;
        Calcul: IMsMethodCalculation;
        Per: IMsModelPeriod;
        CallBack: MsCallbackimpl;
        XmlNode: IXmlDomElement;
        cl: FreeThreadedDOMDocument60;
    Begin
        ActiveMetabase := MetabaseClass.Active;
        cl := New FreeThreadedDOMDocument60.Create;
        cl.loadXML(Memo1.Text);
        XmlNode := cl.documentElement;
        Transform := New MsFormulaTransform.Create(ActiveMetabase);
        Transform.LoadFromXml(XmlNode);
        TransformVar := Transform.Outputs.Item(0);
        Coord := Transform.CreateCoord(TransformVar);
        Slice := TransformVar.Slices.Item(0);
        Selector := Transform.CreateSelector;
        Selector.Slice := Slice;
        Formula := Transform.Transform(Selector);
        Calcul := Transform.CreateCalculation;
        Per := Calcul.Period;
        Per.IdentificationStartDate:= DateTime.ComposeDay(200011);
        Per.IdentificationEndDate:= DateTime.ComposeDay(200411);
        Per.ForecastStartDate:= DateTime.ComposeDay(200511);
        Per.ForecastEndDate:= DateTime.ComposeDay(200711);
        Calcul.CurrentPoint:= DateTime.ComposeDay(200511);
        CallBack := New MsCallbackimpl.Create;
        Formula.Execute(Calcul,Coord, CallBack);
    End Sub Button1OnClick;
End Class TestForm;

After executing the example the model parameters are loaded to the TRANSFORM variable. The modal method is calculated.

See also:

IMsFormula