IExpression.Substitutions

Syntax

Substitutions: IExpressionSubstitutions;

Description

The Substitutions property returns the collection of substitutions used in expressions.

Comments

Substitutions are used to reduce the text of expressions by using abbreviated notations of functions or values. During calculations the corresponding full notation will be used instead of the abbreviated notation.

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. While 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 component's IntelliSense.

See also:

IExpression