Templates

Template Language

The SM-Reports Template Language is a simple scripting language that specifies in a precise way the layout of a report. It is called a script language because it has a vocabulary of special words which are then interpreted line by line to construct a report.

  • Each script line must begin with a keyword that indicates what is being described on the remainder of the line.

When SM-Reports prints a report it reads the first line of script in the report template, and uses the information on that line to start building all the elements of the report. Each line of the report template is read and acted on in sequence until the last line of the report template is reached. The completed report is then sent to the printer where it is converted to a printed page.

Each line of the template script must follow the rules of the keyword at the start of the line to allow SM-Reports to correctly interpret the template and print the report. The template must follow a structure that determines where some keywords must appear. To understand how the report is drawn before sending it to the printer there are several concepts that should be understood.

As each page is printed it begins as a blank page. To construct the report the script sets up different "pens"," brushes" and "fonts". These properties are the way of describing how lines are drawn, areas are filled, and text is placed on the page. Each pen, brush, and font can have different characteristics that determines the appearance of, for example, the text on the page.

Many keywords require four numbers that specify the frame, or rectangle inside which the element appears.

  • Coordinates are from the top left corner of the page with units that are in tenths of a millimetre.

Other keywords refer to field names that are used in a template. The field names used in a template determine which field from the Set Report Definition command are used to the fill the report page.

The next topics show four sample templates. The first of these templates has detailed comments that describes the lines in the file and why they are used. The second template prints the same report as the first one but has the comments removed so you can get a better sense of the flow of the script.

The other two templates have less comments and only comment on features that are not in the Sample course - Commented template. Viewing these templates in the Edit Template command and reading the comments and making changes to the script is a good way to learn how to create new templates.

 

Contents
Search