Creating Full Scripts

Use the full script facility in the JADE Report Writer Designer application when a single expression is not sufficient to derive a field.

The most common need for a full script is if your field is derived conditionally. A simple example would be if the field is conditional on a date; for example, you might want to print a derived currency value only at year end.

When you select the full script option, skeleton code is provided in the Script Code sheet of the Add Script Field dialog, as shown in the following image.

The JADE Report Writer script facility provides a coding structure that is very much like JADE code. However, you do not have to know JADE code or even have previously written any computer programs. The Add Script Field dialog provides all of the tools that you need to enable you to form script code to derive simple and complex fields.

As the above image shows, the result of the execution (running) of this code for your derived field must be returned with a return instruction (just before the end statement at the end of the skeleton script code). The default return type is String[100], which means your derived field is a string of alpha-numeric characters with a maximum length of 100 characters. You can change the return type by clicking on the Define Return Type button next to the Return Type text box.

All of the commands that you need are described in Appendix B, "Script Commands". The return types are described in Chapter 1 of the JADE Encyclopaedia of Primitive Types.

All aspects of the code follow JADE coding rules, except the field names, which you have to select from the Field Catalog folder in the Fields list box at the upper center of the dialog. If you are not familiar with JADE code, you have the same facility to select commands and methods that you have with single expression scripts.

All of the examples in this section are aimed at users who are not familiar with JADE code. You should experiment with single expression scripts before you attempt more complex scripting. For examples of single expression scripts, see "Single Expression Script Examples", earlier in this appendix.

For more details about creating full scripts, see the following subsections, later in this appendix.

The scripting language that is available with the JADE Report Writer is based on the JADE programming language. In general, there are few restrictions on the use of any part of the JADE language in your scripts. Some JADE language features, largely those used in transaction control and the creation and deletion of object and non-JADE Report Writer method calls or object property references, are not allowed in report scripts, and using them returns an error (for details, see "Script Language Restrictions", earlier in this appendix).

However, it is not necessary to acquire a complete knowledge of the JADE language where the aim is to have more flexibility in how you derive report fields using the range of fields types and script methods that are available within the JADE Report Writer Designer application.

For reference material to help you create complex scripts, see: