Checks a block of commented out formula language code for errors.
@CheckFormulaSyntax(formulaText)
formulaText
Text. The formula code to test for errors, commented out. Enclose the formula code in braces ({}) to comment out the code.
errorInformation
Text or textlist.
errorMessage: Message returned by the compiler.
errorLine: Line where the error occurred, beginning with 1, not zero. New lines created by wrapped text are not counted.
errorColumn: Number of character spaces from the first character in the line where the error occurred, beginning with 1.
errorOffset: Number of character spaces from the first character in the formulaText block where the error occurred, beginning with 1.
errorLength: Length of the text making up the error.
errorText: Text or token that the compiler processes as the cause of the error.
The formula you are checking is not "commented out". {) are quote characters. The argument to the function is a string which contains the formula to be checked, not a comment. It is no different from any other function that takes a string argument. The reason { } is used in the examples rather than the more usual double quotes, is because the string you are quoting is likely to contain double quotes. Using { } avoids "escaping" the quotes within the text. If the value is not hard coded but read from a field, as it would be in most applications, this is not an issue.
This @function reports compile errors, not run-time errors. A run-time error is generated, for example, if a function has an insufficient number of arguments. This function is useful especially if you are using the @Eval function to execute a text expression at run-time, since you can use it to first check the syntax of any text you supply to @Eval.
formula := {subject:="test";
remark:="ok";
SendTo:="Darrin Dogs/Star";
@MailSnd(SendTo;"";"";subject;remark;"ID";[Sign]:[Encrypt])};
@CheckFormulaSyntax(formula);
formula := {subject:="test";
remark:="ok";
SendTo:="Darrin Dogs/Star";
@MailSend(SendTo;"";"";subject;remark;"ID";[Sign]:[Encrypt])};
@CheckFormulaSyntax(formula);
@If(@ThisValue= "";
@Return(@Failure("You must enter a formula here."));
0);
-tmp[1] := @CheckFormulaSyntax(@ThisValue);
@If(_tmp[1] = "1";
= "1";
@Success;
@Failure("Invalid formula: " + -tmp[1] + " on line " + -tmp[2]))