IExpressionCategory.Add

Syntax

Add(Reduction: String; Substitution: String): IExpressionSubstitution;

Parameters

Reduction. Abbreviation for substitution.

Substitution. Full notation to be used when calculating the expression.

Description

The Add method adds a new substitution.

Example

Executing the example requires a form with a button on it, named Button1 and the MetaAttributesEdit component named MetaAttributesEdit1.

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 will be added to the list of substitutions of the expression linked to the MetaAttributesEdit1 component. On creating expressions, it is available to use abbreviated notations for functions Sin, Cos, Tan of the custom function MyFunc, contained in the Module_1 unit, and the specified constant. These abbreviations are available in IntelliSense of the component.

See also:

IExpressionCategory