CreateEx;
The CreateEx constructor creates an instance of the error containing the text #VAL!.
This constructor is used to create an instance of the error containing the text #VAL!. The message text is translated in the resources of Foresight Analytics Platform that is why the message returned in the IException.Message property will depend on the currently used analytics platform interface language.
Executing the example requires that the repository contains a regular report with connected unit. Add a link of the following type to the cell:
=<unit identifier>.<function name>(value of the first parameter, value of the second parameter)
A value or cell address with value can be set as parameter value.
For example:
=TABNOTNUMBEREXCEPTION_CREATEEX.Test(A0,B0)
where:
TABNOTNUMBEREXCEPTION_CREATEEX. Unit identifier.
Test. Function name.
A0, B0. Cell addresses containing parameter values.
Add a link to the Tab system assembly.
Public Function Test(A, B: Variant): Variant;
Begin
If A.VarType <> B.VarType Then
Raise New TabNotNumberException.CreateEx;
Else
Return A + B;
End If;
End Function Test;
The example is a macro for a regular report. The macro runtime checks types of the passed parameters. If all the parameters have the same type, the function returns sum of parameter values. If the types differ, the function throws an exception. When an exception is thrown, the table cell shows error text. If Foresight Analytics Platform uses Russian, the error text is #ЗНАЧ!, if the platform uses English, the error text is #VAL!, and so on.
See also: