JavaScript tool enables report templates to evaluate or run JavaScript codes from templates and external JavaScript files, see figure below.

The general concept behind this JavaScript feature is to separate complex business logic from presentation logic. Complex logic should be executed by JavaScript, and presentation logic should be executed by Velocity code.

Class Diagram: JavaScript tool.

JavaScript tool includes 3 methods:

(i) 'eval' Method
     this method will evaluate JavaScript text, and then return the result.
(ii) 'execute' Method 
     this method will execute a JavaScript file, and then return the result.
(iii) 'call' Method 
      this method will call a JavaScript function, and then return the result.

Like other Custom tools, the JavaScript tool 'scripttool.jar' must be installed in the 'extensions' folder of the Report Wizard plugin. The same 'js.jar' of the Automaton plugin is used, so make sure the Automaton plugin is enabled and loaded. For further information about Custom tools and the installation, see Custom tool.

To import JavaScript tool to a template type, for example:

#import('js', 'com.nomagic.reportwizard.tools.script.JavaScriptTool')