Quick Reference and Examples

A script is called using the designer function Script$(<language>, <code>, < opt:function>,<opt:timeout>) in the project file within the formula editor and returns a string as result. Alternative forms like ScriptVal, ScriptBool and ScriptDate work analogously except for the return type. Details can be found in the Designer Manual.

 

Script$

Interprets the result of a script as a string.

Parameter:

String              Determines the script language to be used. Primarily CSharpScript as well as VBScript and JScript are supported

String              Script code to be executed

String              (optional) Defines the result of the return under VBScript, it contains either the name of the function/method to be executed or a variable name. For C# this parameter is ignored and values are returned directly by assigning the variable WScript.Result

Number           (optional) Timeout in ms

Return value:

String

Example:

Examples for C#:

Script$('CSharpScript',' WScript.Result= "Language: " + Report.Variable("LL.CurrentLanguage"); ')

 

Script$('CSharpScript', LoadFile$(ProjectPath$(false) + "Script.cs"))

For further reference, the extended example of the sample application includes the project "Order list with scripting.srt".

 

Examples for VBScript:

Script$('VBScript',' RetVal= "Language: " + Report.Variable("LL.CurrentLanguage") ', 'RetVal')

 

Script$('VBScript', LoadFile$(ProjectPath$(false) + "Script.vbs"), RetVal)