CreateStringGenerator: IMsFormulaStringGenerator;
The CreateStringGenerator method creates a generator of string presentation of the model calculation method.
Executing the example requires that the repository contains a modeling container with the CONT_MODEL identifier. This container should contain a model with the MODEL identifier.
Add links to the Metabase and Ms system assemblies.
Sub UserProc;
Var
mb: IMetabase;
DescrCM:IMetabaseObjectDescriptor;
pModel:IMsModel;
Transform:IMsFormulaTransform;
pSelector:IMsFormulaTransformSelector;
pFormula:IMsFormula;
pGen:IMsFormulaStringGenerator;
Begin
mb := MetabaseClass.Active;
DescrCM := mb.ItemById("CONT_MODEL");
pModel := mb.ItemByIdNamespace("MODEL",DescrCM.Key).Bind As IMsModel;
Transform := pModel.Transform;
pSelector := Transform.CreateSelector;
pSelector.Slice := Transform.Outputs.Item(0).Slices.Item(0);
pFormula := Transform.Transform(pSelector);
pGen := pFormula.CreateStringGenerator;
pGen.ShowFullVariableNames := False;
Debug.WriteLine("Model calculation method name after automatic generation: '" + pGen.Execute + "'");
End Sub UserProc;
After executing the example the string view of model calculation method is generated and displayed in the console window. For example:
Module execution started
Model calculation method name after automatic generation: Y[t] = X1[t] * X2[t] + k
Module execution finished
See also: