EvaluateScript
(not exposed/documented prior to 4.0)
EvaluateScript( typescript )
Evaluates a typescript command. Returns the typescript output as a string.
Warning: There are some dangerous aspects to this function. It is not a function most users will want to make use of. However, because it provides access to typescript from expressions, it does open up some doors, making something things possible that would not otherwise be. But, if you use EvaluateScript, Analytica does not prevent you from "shooting yourself in the foot".
Despite the warning, there are many legitimate uses.
Example
The following creates a list of all keywords in Analytica:
index kw:= Split( EvaluateScript("list keyword")," "); subset(kw<>"")
Error Handling
When an error occurs while processing the typescript, the error message is returned in the text of the result. In Analytica 4.2 and later, the optional «showErr» parameter can be specified as true to halt execution and display the error:
- EvaluateScript( "show nothing" ) → "Syntax error at line 1: Undefined name."
- EvaluateScript( "show nothing", showErr:true ) → { Evaluation stops, error dialog appears }
Enable comment auto-refresher