Execute(
Calculation: IMsMethodCalculation;
Coord: IMsFormulaTransformCoord; Callback: IMsFormulaExecuteCallback);
Calculation. Determines parameters that are necessary for method calculation.
Coord. Determines coordinate's parameters in the variable, by which calculation is performed.
Callback. Determines object for feedback on method calculating.
The Execute method calculates the method.
Executing the example requires a form, the button Button1 that is placed on this form and the Memo component with the Memo1 identifier. The Memo1 component must contain model parameters as an XML code.
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(2000, 1, 1);
Per.IdentificationEndDate := DateTime.ComposeDay(2004, 1, 1);
Per.ForecastStartDate := DateTime.ComposeDay(2005, 1, 1);
Per.ForecastEndDate := DateTime.ComposeDay(2007, 1, 1);
Calcul.CurrentPoint := DateTime.ComposeDay(2005, 1, 1);
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: