Report Scripts
Previous Topic  Next Topic 

A script is a program written in a high-level language that becomes part of a report. When the report runs, the script runs as well. A script can handle data in ways that  are not possible using the normal operations of the DMS Reports core.  For example, a script can be used to display calculated information, change an object's properties based on a condition, etc.


A script is written in one of the languages supported by the script engine. Currently, these are:


  1. PascalScript
  2. C++Script
  3. BasicScript
  4. JScript


Note that the help documentation and tutorials are not intended to teach you any of the above script languages.  In order to write a script, a background in programming is highly recommended and a knowledge of Pascal, C++, BASIC or Java is an asset.  


Warning:  Do not change a report's script language after you have written a script.  Changing the scrip language will delete any existing scripts because the DMS Report Designer has to prepare for the new language format.


The following features are supported by the script engine:



The script engine however does not support the declarations of  records or classes, pointers, sets (but the 'IN' operator can be used in expressions such as "a in ['a'..'c','d']"), shortstring type, and unconditional jumps (GOTO).


Scripts are created in the Report Designer using the script editor found on the Code tab. There is also an embedded debugger which has the functions Step, Breakpoint, Run to cursor and Evaluate.


The correct syntax of the scripts is a strong rule!


An example of the script window is below:



Legend:


  1. Scripts are entered on the Code tab.  To switch back to the report page, select the Page tab.
  2. This area is the script editor pane where you enter and edit the scripts.
  3. The script language is selected from the drop down list.  Do not change the script language once you have entered a script or else your script will be lost.
  4. Debugger toolbar:
    1.  Run report in debugging mode (F9)
    2.  Run to cursor (F4)
    3.  Execute the regular code line (Step into, F7)
    4.  Interrupt running script (Ctrl+F2)
    5.  Preview value of expression (Evaluate, Ctrl+F7)
    6.  Toggle breakpoint (F5)
  5. Bookmarks and breakpoints are displayed in this column; also, the current line of executing code is shown here


To try writing your first script, see the Report Scripts using Jobs Tutorial.


For more detailed information on the script engine, the following topics are covered:


  1. Structure of a script 
  2. Using objects in a script 
  3. Referencing Dataset Fields and Report Variables in a Script
  4. Aggregate Functions in a Script 
  5. Declaring Script Variables
  6. Report Events 
  7. Script to Print a Group Sum in the Group Header 


DMS uses the FastScript engine.  A detailed description of the FastScript engine can be found in the FastScript Documentation in PDF format.