Add(Reduction: String; Substitution: String): IExpressionSubstitution;
Reduction. Abbreviation for substitution.
Substitution. Full notation to be used when calculating the expression.
The Add method adds a new substitution.
Executing the example requires a form that contains the Button component with the Button1 identifier and the MetaAttributesEdit component with the MetaAttributesEdit1 identifier.
The example is a handler of the OnClick event for the Button1 component.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
Exp: IExpression;
Substs: IExpressionSubstitutions;
Cat: IExpressionCategory;
Begin
Exp := MetaAttributesEdit1.Expression;
Substs := Exp.Substitutions;
Cat := Substs.Add("MyCategory");
Cat.Add("Sin", "MathFin.Math.Sin");
Cat.Add("Cos", "MathFin.Math.Cos");
Cat.Add("Tan", "MathFin.Math.Tan");
Cat.Add("MyConst", "1354226.31131");
Cat.Add("MyFunc", "Module_1.MyFunc");
End Sub Button1OnClick;
After executing the example when the button is clicked, a new category containing five user substitutions is added to the list of substitutions of the expression linked to the MetaAttributesEdit1 component. While creating expressions, one can use abbreviations for the functions Sin, Cos, Tan of the MyFunc custom function contained in the Module_1 unit, and the specified constant. These abbreviations are available in IntelliSense of the component
See also: