.



Core Functions    
Creating reports

SuperReport Pro

SuperReport Pro provides added flexibility in report generation. Its presence not only permits the creation of more complex reports than the Quick Report generator, but also the design and use of custom forms when printing Invoices, Delivery Notes, Purchase Orders and so on.

A SuperReport Pro report is the format or template document created by you, the user, that will be used to generate printed output (whether previewed on screen, or in printed form from a printer). The report contains the objects and sections that are used at print time to determine what to print and where on the page to print it.

The report document contains more information than just the objects displayed within the page editor area. It also contains details of how many sections (header, body, subtotal, footer etc.) the report contains, what value changes will trigger break processing, which fields or variables are to be subtotalled, and what scripts are to be executed before, during and after the report is generated. The report document also contains the Page Setup information for the report, the positions of any guides along with the ruler units (point, mm or inches) used by the report.

SuperReport Pro documents are stored inside the Enterprise 6 data file. This makes multi-user access to reports much easier to manage.

Please note that SuperReport Pro is a third-party product, which means that its function and features may change from time to time. 

Opening SuperReport Pro

Subject to the details described below, SuperReport Pro can be activated either by clicking the [Report] button in the Buttons Palette at a listing screen, or by clicking the [Edit Templates] button on the Forms Settings 2 page of Preferences.

Printing SuperReports

When the [Report] button is clicked from a listing screen, you are shown a listing of all existing Reports defined for the file in which you have just performed a query. At the base of the list is a [Print] button.

For example, if you have a listing of Companies on screen, clicking the [Report] button will list all reports based on the Companies file. From there you can immediately highlight one (or, in fact, more than one) report and press the [Print] button. The resulting report(s) will cover all the Companies in the listing or, if applicable, all highlighted Companies. The report list can be queryed, sorted, selected etc in the normal way. Double-clicking on a line will bring up that report format for editing, and clicking the [+] button will allow you to design a new report format.

The [Edit Templates] button provides a list of all the SuperReport report formats in Enterprise 6 and again the formats can be edited and new ones created. However, you will not be able to print.

SuperReport Pro and preferences

If you have SuperReport Pro, you should switch on the ‘Use SuperReport Report Generator’ check box on the General page of Preferences. If you do this, clicking the [Report] button in the palette with a listing on screen will load the SuperReport Pro window, rather than the Quick Report generator described in an earlier section. Clicking the [Report] button with the <Alt> key held down will bring up the standard report window. If you do not switch on the check box, but SuperReport Pro is present, the button’s function will reverse - <Alt>-clicking it will load SuperReport Pro.

Using SuperReport Pro forms

Enterprise 6 is able to use a number of custom forms designed in SuperReport Pro, such as Invoice or Purchase Order. Care should be taken to ensure that the Report Codes (see below) of these forms are not modified, to ensure that Enterprise 6 can find them when necessary.

Currently, Enterprise 6 can use the following SuperReport forms:

“SR Invoice” and “SR Invoice DT” (ie an Invoice with a separate delivery address) (from the Sales Invoices file, number 39)

“SR Order Quote”"

SR Order Auth”

“SR Order Ack”

“SR Delivery” (from the Sales Orders file, number 24)

“SR Movement” (from the Stock Movements file, number 40)

“SR Purch Order” (from the Purchase Orders file, number 57)

“SR Remittance” and “SR Cheque” (from the Purchase Invoices file, number 37)

SR Contract” and “SR Call Sheet” (from the Service Contracts file, number 17).

If you wish to create your own versions of these forms, they must retain the Report Codes of those supplied as templates, and must be allocated the correct File Numbers (again, see below).

Many functions in Enterprise 6 result in printed output, such as Invoices, Delivery Notes or Purchase Orders. If the Preference ‘Use SuperReport Generator’ is switched on, selecting such a function will cause Enterprise 6 to find the SuperReport Pro version of the form. If it can’t find the SuperReport form, the built-in form will be used instead. Selecting the print function with the mouse and with the <Alt> key held down will also cause Enterprise 6 to revert to the default built-in form. However, if that Preference is switched off, but SuperReport is present, then the <Alt> key can be used to invoke the SuperReport form as the built-in form will be used otherwise.

Creating SuperReports

As mentioned above, the SuperReport Pro Report Generator can be invoked by clicking the [Report] button in the Buttons Palette or the [Edit Templates] button on the Forms Settings 2 page of Preferences. In the former case, a list of the available reports for the file in question is immediately produced. If there are no reports defined for the file, or if you press the [+] button, you are taken to an entry screen with the title ‘Create a SuperReport’. It is similar to the Documents entry screen (and, in fact, uses the same file), having a Report Code and Name, plus a Person.

When editing a form template (such as SR Invoice), care must be taken not to alter the Report Code, to ensure that Enterprise 6 can find the form when necessary. The screen also has an Analysis field so that Forms can be created that are unique to given Analyses, perhaps containing different departmental addresses. Such forms should be distinguished by the use of suffixes in the Report Code field (for example, SR InvoiceA, SR InvoiceB, etc). The File Number field will automatically be filled in with the File Number of the file for which you chose to create the report. If creating a new form such as SR Invoice, care must be taken to ensure the File Number refers to the correct file. Changing it, either by typing or by choosing from the pop-up, will also change the setting within the SR area of its ‘SuperReport: Report File/Iterations’ menu item.

Saving SuperReports

As with 4D Write, it is valid to save documents to disk using the SuperReport File menu. However, this is generally unnecessary, since when you accept the SuperReport window, the report will automatically be saved within the data file.

SuperReport Pro editor window

The SuperReport Pro editor window allows you to create and modify report documents, and to print them. To bring it up, click the [Report] button in the Buttons Palette or the [Edit Templates] button on the Forms Settings 2 page of Preferences.

In the former case, a list of the available reports for the file in question is immediately produced. In the latter case, a list of available reports for all files is displayed.

If there are no reports available to be listed, or if you press the [+] button at the listing, you are taken to an entry screen with the title ‘Create a SuperReport’. This will enable you to create a new report.

SuperReport Pro has its own menu bar. All the functions that you will need in order to make use of SuperReport Pro are available either on this menu bar, or within the SuperReport Pro editor window itself.

The report editor will allow you to select the paper type for the report (using the ‘Page Setup…’ command), to place objects (fields, variables, lines and other graphic objects) on the report, to define the different sections of the report (header, body, total and footer etc), to specify the number of break levels (for subtotalling), and what 4th Dimension procedures and scripts are to be executed as the report is generated. The report editor area is used to create or modify the report - using this area you can define the sections for your report along with the objects that the report will contain. The toolbar area contains the following tools (reading from left to right): Arrow tool for selecting, resizing and dragging objects Text tool for adding new static text items Field tool for adding new fields from the database Variable tool for adding new variable from the database Line tool for drawing either horizontal or vertical lines Box tool for drawing rectangles (and/or grids) Circle tool for drawing circles Alignment tool for aligning selected objects (a pop-up menu appears)

Report objects

Anything contained within a report is a report object. Text areas, fields, variables, lines, boxes and circles are all objects.

Creating a new object

With the exception of the alignment tool, the tools in the toolbar are used to create and manipulate objects on the report. After clicking on one of these new object tools, move the mouse on to the report (in the editor area beneath the toolbar), and drag a rectangle. The appropriate object will be drawn according to the tool you selected within that new rectangle. See the sections ‘Adding a Field’ and ‘Adding a Variable’ that follow.

Selecting objects

Selecting an object is achieved by first selecting the Arrow (Selection) tool, and then by clicking on the appropriate object within the report. A selected object is distinguished by “handles” (black rectangles) at its corners.

To de-select an already selected object, click on it while holding down the <Shift> key. Clicking on the object again with the <Shift> key will again select the object.

If you click on part of the report that contains no objects, any selected objects will become de-selected.

If you wish to select a group of objects quickly, then you can click on the report page (but not on an object) and drag a “marquee” over the objects to be selected - any objects that are touched by or are within the marque will become selected. Any previously selected objects will become de-selected unless you are holding down the <Shift> key in which case the newly selected objects will be added to those previously selected.

Moving objects

If you click within an object that is already selected, then SuperReport Pro will assume that you wish to move the object, and will allow you to drag it around. If more than one object is selected, then all the selected objects will be moved.

SuperReport Pro also allows you to “nudge” objects using the cursor keys. If you have selected one or more objects, and you press any of the four cursor (arrow) keys, the selected objects will be moved by one pixel in the direction of the cursor key. For example, if you press the up arrow cursor key the selected objects will be moved up by one pixel. Holding down the <Alt>  key while pressing any of the cursor keys will cause the selected objects to be nudged by ten pixels instead of one pixel.

Resizing objects

If you click within the object’s “handles” then SuperReport Pro will assume that you wish to resize the object, and will allow you to drag the corner around, until you release the mouse button.

When creating a new object on the label, or resizing an existing object, holding down the <Shift> key has the effect of making the height and width of the object the same (as the object is dragged). This feature is useful for creating squares (as opposed to rectangles) and circles (as opposed to ovals).

Objects can also be resized using the cursor keys. If you hold down the <Command> (Macintosh) or <Control> (Windows) key while pressing any on the cursor keys, any selected objects will be resized. Pressing the <Alt> key as well will cause the object to be resized by ten pixels as opposed to one pixel. When the up arrow or down arrow cursor keys are pressed, the lower boundary of the selected objects will be resized in a vertical direction, and when the left arrow or right arrow cursor keys are pressed, the right hand boundary of the selected objects will be resized in a horizontal direction.

Aligning objects

To align two or more selected objects on the report, click in the Alignment icon within the toolbar, and hold the mouse button down. An alignment palette will appear allowing you to specify how you want the selected objects aligned. While keeping the mouse button pressed down, you may drag the mouse within the palette to select the alignment that you want, then release the mouse. If you drag the mouse outside of the palette and release the mouse, no alignment will take place.

The six alignment options are: left aligned, align tops, align vertical centres, align horizontal centres, align bottoms, and right aligned. Note that the alignment of objects is different from the alignment of text within an object.

Setting the pattern and colour of objects

SuperReport Pro allows you to specify the pattern and colour of objects; both for the object’s “fill” and for the object’s border. The pattern and colour pop-up icons to the right of the Pen tool are used to change the object’s border attributes, while the pattern and colour pop-up icons to the right of the Paint Pot tool are used to change the object’s fill attributes.

Changing the line thickness of objects

SuperReport Pro allows you to specify the line thickness of lines, rectangles and ovals using the Line Thickness selection area.

To change the lines thickness of one or more objects, select the object or objects, and click on the required line thickness in the Line Thickness selection area to the right of the tool palette. Line thicknesses may be a hairline, or 1 point up to 8 point in thickness. Changing the line thickness only applies to lines, and the borders of rectangles and circles - it has no meaning for other object types.

Adding a text object

Select the Text tool from the toolbar, and drag the text object’s rectangle within the report. Once you release the mouse button, a dialogue box will appear allowing you to enter the static text that you want to appear within the rectangle, and to set the object’s positioning options (using the check boxes). The text positioning options are described below in the section ‘Object Positioning’.

Setting an objectÕs text attributes

SuperReport Pro allows you to control the text attributes of objects, fields and variables that contain text. You may determine the font, the size, the style and the justification of text within the object. An object’s text attributes are set “globally” for the object - you may not make particular words within the object have different text attributes. To change the text attributes for one or more objects, first select the object or objects, and then use the appropriate text options shown in the toolbar (above).

To change the font of an object, click on the pop-up arrow marker to the left of the font name in the tool palette (shown as “Geneva” in the illustration). A pop-up menu will appear listing all the fonts available within your system. The object’s font will be changed to whichever new font you select.

To change the font size of an object, click on the pop-up arrow marker to the left of the font size (shown as “9 Pt” in the illustration). A pop-up menu will appear listing all the fonts sizes available within your system. If you select the ‘Other…’ item from the pop-up menu, then a dialogue box will appear allowing you to enter a font size between 1 and 144 points - fractional fonts are not supported. The object’s font size will be changed to whichever new font you select.

To change the font style of an object, click within one the font style boxes. You are able to choose between plain text, bold text, underlined text, italic text, outlined text and shadowed text, or any of these styles in any combination. When changing the font, size or style of an object, SuperReport Pro will adjust the bottom of the object to accommodate a “whole” number of lines of text for your chosen font, size and style combination.

To change the justification of text within an object, click within one of the three justification options (the three icons at the top right of the toolbar). The three available justifications are left, centre and right justified (reading from left to right). Whenever you select one or more objects, SuperReport Pro will “show” you the font, size, style and justification of the selected objects using the text tools in the toolbar. If you select two text objects, one of which is Geneva 9 pt and the other Helvetica 9 pt, then SuperReport Pro will not show a font name (since the fonts are different), but will show the font size as “9 Pt”, since this is a common attribute for both objects.

If you wish to change the default font, size, style and justification for new text objects, then make the text attribute changes when no objects are selected. Any new text objects that are subsequently created will take the new default attributes.

Adding a field

Select the Field tool from the toolbar (the third tool from the left), and drag the field’s rectangle within the report. Once you release the mouse button, a dialogue box will appear allowing you to name the field, to select the print formatting (for number, date, time, boolean and picture fields), and to set the object’s positioning options (using the check boxes).

To name the field, choose a field from the file/field pop-up menu that is displayed when you click on the pop-up menu icon to the right of the word “Field”. For number, date, time, boolean and picture fields, you may select one of the pre-defined formats from a pop-up menu that will appear when you click on the pop-up menu icon to the right of the word “Format”.

You may enter your own format string directly in the Format text area instead of using one of the pre-defined formats, if you wish. See the section on ‘Object Formatting Strings’ below. The field positioning options are described below in the section ‘Field and Variable Object Positioning’. For details of the [Calculate…], [Repeat…] and [Script…] buttons see the later sections on ‘Automatic Calculations For Objects’, ‘Repeating Objects’, and ‘Scripts’.

Adding a variable

Select the Variable icon from the toolbar (the fourth tool from the left), and drag the variable’s rectangle within the report. Once you release the mouse button, a dialogue box will appear allowing you to name the variable, to specify the variable type, to select the print formatting (for number, date, time, boolean and picture fields), and to set the object’s positioning options (using the check boxes).

To name the variable, choose a variable from the variable names pop-up menu that is displayed when you click on the pop-up menu icon to the right of the word “Variable”. Having selected the variable name, the variable’s type will automatically be displayed. If the variable names pop-up menu is not active, or you wish to use a variable not listed in the menu, you may enter the variable name directly into the Variable text area.

You may specify the type of the variable using the Type pop-up menu. SuperReport Pro supports three types of variable and variable access. These are “variable”, “array (automatic)”, and “array element”. For number, date, time, boolean and picture variables, you may select one of the pre-defined formats from a pop-up menu that will appear when you click on the pop-up menu icon to the right of the word “Format”.

You may enter your own format string directly in the Format text area instead of using one of the pre-defined formats, if you wish. See the section on ‘Object Formatting Strings’ below.

The variable positioning options are described below in the section ‘Field and Variable Object Positioning’.

For details of the [Calculate…], [Repeat…] and [Script…] buttons see the later sections on ‘Automatic Calculations For Objects’, ‘Repeating Objects’, and ‘Scripts’.

Object formatting strings

The object formatting strings are the values that are entered into the Format text area - these are used at print time to format the object’s text according to the object’s data type.

Format String Displayed As

Date format strings:
  1. Short 1/1/92
  2. Abbrev Mon, Jan 1, 1992
  3. Long Monday, January 1, 1992
  4. Short2 01/01/92
Time format strings:
  1. 12:24:15
  2. 12:24:15 12:24
  3. 12:24
  4. 12 hrs 24 min 15 secs
  5. 12 hours 24 minutes 15 seconds
  6. 12 hours 24 minutes
  7. 12 hours 24 minutes
  8. 12:24 pm
Boolean format strings:
  1. yes;no
  2. Married; Single

A boolean value that evaluates to TRUE will have the “yes” text substituted at print time, while a FALSE value will have the “no” text substituted. The text for TRUE and FALSE format strings lie on the left and the right of the separating semi-colon (“;”) and can be any or no text.

Numeric format strings:
(applicable to Reals, Integers and Longints) positive;negative;zero

  1. US$###,###0.00 000,000.00;(000,000.00);0.00 $^^^,^^^,^^0.00

The semi-colons separate format strings for positive, negative and zero numbers.
The following four symbols are place-holders, #, 0, ^, *.

The following table illustrates the effect that the place-holder has on leading or trailing zeros:
#: No effect
0: Displays 0
^: Displays a “hard” space (ASCII 202)
*: Displays a *

If you are to print large numbers, be sure to ensure that you provide sufficient place holders otherwise the numeric value will be printed as “<<<<<<”.

Picture format strings:
Normal: Right and bottom edges may be clipped
Centred: All edges may be clipped
Scaled: Picture scaled within object’s rectangle
Scaled (proportional): Picture scaled proportionally

Field and variable object positioning

SuperReport Pro allows you to control the relative positioning of any object within the printed report, or to fix an object’s position.

Field and Variable objects have more options that allow you to control the width and depth of the object and the object’s effect on other objects. These options are available to you when you create the object, or if you double-click within the object, or by selecting the object and choosing the ‘Modify Object…’ command from the SuperReport Pro Edit menu.

Fix horizontal/fix vertical

These check boxes allow you to fix either the horizontal or vertical position of the object, or both, in relation to the other objects on the report. Any adjustment in a object’s rectangle at print time may cause an appropriate adjustment to other objects at print time unless their Fix Horizontal and Fix Vertical check boxes are checked.

If you have an object near the bottom of the report, and have also defined a text field object above with the Print With Variable Depth option set, you would use the Fix Vertical setting (in the lower object) to ensure that it remained at its current position, regardless of how small or large the text field object above became at print time as a result of the amount of text within it. Otherwise, the lower object would either be “pulled up” or “pushed down” in sympathy with the rectangle changes of the text field object above.

Print with variable depth

This option will cause SuperReport Pro to extend the bottom boundary of the object’s rectangle sufficiently to accommodate the field or variable text. This enables you to define a field or variable object as only one line in height, set the Print With Variable Depth option (by checking the check box), and let SuperReport Pro adjust the object’s rectangle for you.

If the object’s rectangle is either contracted upwards or extended downward to accommodate the text, then any objects below that object will be repositioned accordingly unless their Fix Vertical setting is set, even if they are not directly beneath the ‘variable depth’ object but are still below it to either side.

Print with variable width

This option will cause SuperReport Pro to extend the right boundary of the object’s rectangle sufficiently to accommodate the field or variable text. Again, like the Print With Variable Depth option described above, this will cause any other objects at the same height on the report, and to the right of the original object to be displaced horizontally in sympathy with the object’s shrinking or stretching unless their Fix Horizontal setting is set.

When the Print With Variable Width option is set, and the field or variable object is empty (ie contains no text) then SuperReport Pro will automatically “pull” the next object to its right into its position. This is useful for example when you place three fields Title, Firstname and Surname on the same line and let SuperReport Pro take care of the fact that for some records you may have the title or firstname missing. The Print With Variable Depth and Print With Variable Width options are mutually exclusive. In other words you may not have both these options set at the same time. If you set one, and the other option is already set then SuperReport Pro will automatically unset the other for you.

If empty, replace by items below
This option allows you to “collapse” an empty object, replacing it by the next item below, and pulling up any other items below by the height of the “collapsed” object. Again, setting the Fix Vertical Position option in any of the items below will prevent them from being “pulled up”. The If Empty, Replace By Items Below option is useful for addresses where the address is broken into individual lines, some of which may be empty. Using this option SuperReport Pro will generate the address with any blank lines automatically removed. The field and variable attributes that deal with subtotalling and repeating objects are dealt with later. An explanation of the scripting capabilities for objects is also described later.

Adding a picture

To add a graphic, such as a logo, to the report, copy the graphic from the Scrapbook, or your graphics application to the Clipboard (using the ‘Copy’ command on the SuperReport Pro Edit menu) and make the SuperReport Pro editor window active, and select the ‘Paste’ command from the SuperReport Pro Edit menu. The graphic will be pasted onto the report. You can then move the graphic and resize it as necessary. If you double click on the graphic, SuperReport Pro will display the Pictures Options dialogue box. Using the options available within the dialogue box, you can control how the picture is displayed within the object rectangle, and fix

Changing an object’s options

To change an object’s options, either double-click on the object, or select the object and choose the ‘Modify Object’ command on the SuperReport Pro Edit menu. A dialogue box will appear allowing you to change the object’s options. Different dialogue boxes appear for different types of objects, although all the object options dialogue boxes have the Fix Horizontal Position and Fix Vertical Position check boxes in common.

Rearranging objects

There are four commands on the SuperReport Pro Edit menu, ‘Send To Back’, ‘Send Backwards’, ‘Bring To Front’ and ‘Bring Forwards’ that allow you to place an object behind or in front of an object that it overlaps with. To use any of these commands, select a single (or multiple) objects, and then select the appropriate command. Rearranging objects is used to ensure that the objects are drawn in the correct sequence on your reports. However this feature is also useful for reports that are printed to disk, since the order of the objects determines the order in which the objects are exported. If you need to “see” the object order, then select the ‘Show Object Order’ command from the SuperReport Pro Options menu.

Selecting an object hidden behind another

To select an object hidden behind another without having to send the frontmost object behind (using the ‘Send To Back’ command), hold down the <Command> (Macintosh) or <Control> (WIndows) key while clicking on the object you wish to select. Pressing the <Command>/<Control> key down causes SuperReport Pro to select the rearmost object, rather than the frontmost object (which it does by default). Similarly, if you wish to double-click on an object hidden behind another (to display the object’s options dialogue box), press the <Command>/<Control> key down while double-clicking.

Duplicating an object

To duplicate one or more objects from the report, first select the objects to be duplicated and then select the ‘Duplicate’ command from the SuperReport Pro Edit menu.

Deleting an object

To delete one or more objects from the report, first select the objects to be deleted and then press the key or select the ‘Clear’ command from the SuperReport Pro Edit menu. If you need to undo this operation, select the ‘Undo’ command from the SuperReport Pro Edit menu.

Changing an object from one type to another

To change an object from one type to another, select the object and select the ‘Change Object…’ command from the SuperReport Pro Edit menu. A dialogue box will appear allowing you to change the object to a new type. This feature is sometimes useful for changing fields to variables and vice-versa.

Undoing the last action in the report editor

The last action performed in the report editor may be undone using the ‘Undo’ command on the Edit menu.

Automatic calculations for objects

SuperReport Pro provides a facility for the automatic calculation (such as totalling) of numeric fields and variables.

To make use of this capability, you should click on the [Calculate…] button in the field or variable Object Options dialogue box. If you also need to make use of the calculated value in any report or object scripts then check the Record Value In Variable check box, and specify the variable name in the edit field provided (or select a variable from the pop up menu icon). Once you have selected a calculation type, the [Calculate…] button will have a √ (tick mark) in it to signify that an automatic calculation has been specified. If the object is in a Total or SubTotal1 … SubTotal6 section, then you can select the Show Calculated Value check box which will cause SuperReport Pro to show the calculated value that is appropriate for that section.

Normally objects to be totalled are placed in the Body section of the report with an automatic calculation specified, while objects which are to display the subtotal value (instead of the current value) are normally placed in either the SubTotal1 … SubTotal6 or Total sections, and will have the Show Calculated Value check box checked. However there is no requirement for the object to be placed in the Body section, if you only wish to have the calculated value shown in a SubTotal1 … SubTotal6 or Total section.

Before the report is generated SuperReport Pro will scan all objects defined on the report seeing whether they require automatic calculations and will then maintain a calculation table for those objects while the report is generated.

Automatic calculations can be used for totalling objects, or to produce minimum, maximum, or average values. And they can be used for either field, array or variable objects.

Repeating objects

SuperReport Pro performs special actions for objects that have the Repeating Object check box checked. The only objects that may have this attribute set are fields and arrays - setting this attribute for (non-array) variables is not meaningful. Repeating objects can be used to display information from other files or arrays in a column format.

For example, each Invoice might have one or more Invoice Items belonging to it. If a report was created to print Invoices, it would be possible to show the invoice items for each invoice using the repeating object attribute for the Item fields.

Normally repeating objects are placed in the Body section of a report. They are ignored if placed in the Footer section of the report. As the Body section is processed for each Invoice record, SuperReport Pro computes the number of repetitions of the repeating Item fields based upon the number of records in the Item file selection. The second and subsequent repetition of a repeating object (usually) will be placed immediately beneath the previous (or first) instance of the object. In other words, repeating objects repeat downward resulting in columns of repeated data - although SuperReport Pro allows objects to repeat horizontally as well. When you hit the [Repeat…] button in the Object Options dialogue box, the Repeating Options dialogue box will appear. Here you are able to specify whether you wish the object to repeat or not, and if so whether to repeat either horizontally or vertically. If you do specify that the object is to ‘repeat’, then the [Repeat…] button in the Object Options will be shown with a √ (tick mark) in it.

You can use the ‘Body Script…’ command (on a hierarchical menu displayed when you select the ‘Scripts…’ command from the SuperReport menu) to create a procedure or script to load or query for the related records, and to sort them if you wish, prior to printing the Body section. The same script could also be used to create and load arrays with information to be printed using repeating objects.

When SuperReport Pro encounters a repeating object in a section, it calculates the number of iterations required for that object, and then will generate as many (new) repeating objects as there are iterations, placing the new objects in a position from its predecessor as defined in the Repeating Options dialogue box. SuperReport Pro will also adjust the section height to cater for the extra repeating objects that have been placed on the page as the report is generated.

If you do not wish to use repeating objects, then you can define your report in such a way that (in this example), the Item file is the main file, and the [Invoice] information is displayed in SubHeader and SubFooter sections. The disadvantage of this method is that it requires that you make use of break processing, and it requires more work.

Object scripts

SuperReport Pro allows you to attach an object script to any field or variable object, or section.

To attach a script to a field or variable object, click on the [Script…] button in the Object Options dialogue box. If the object already has a script associated with it, or if you create a new script for the object then the text of the [Script…] button will be preceded by a √ (tick mark). The tick mark is a quick way of seeing that an object has a script associated with it. When an object is viewed on the report page, it is also possible to tell whether it has a script attached to it or not. If it does have a script then the top left handle corner of the object will have an inverted triangle visible - the same is also true for sections that have scripts attached.

When the report is generated, object scripts are executed ‘just before’ they are printed on the report. For example, if an object is in the Body section of a report, and the report prints the Body section five times (because the report is printing a selection of five records), then the object script will be executed five times - each time prior to the object being printed on the page. Object scripts are always executed when defined, even if the section that the object is in is suppressed (for printing using the ‘Select Printing Sections…’ command on the SuperReport menu).

Object scripts can be used to make selections of records in other files, to fill variables with data, or to perform any other action that the 4th Dimension command set will allow. The SuperReport Pro script editor window appears whenever you select the [Script…] button from the Object Options dialogue box, or from the Section Options dialogue box, or when you select one of the hierarchical menu items from the ‘Scripts…’ command on the SuperReport menu. The script editor window contains a text entry field where 4th Dimension statements can be entered. A script may contain one or more lines of valid 4th Dimension statements. SuperReport Pro neither ‘pretty prints’ the text in this area nor checks the syntax of the statements that you enter.

Each line must contain a self-contained 4th Dimension statement because SuperReport Pro does not support any loop or conditional structures. For example the following statements are NOT valid when entered in the script editor window:

If (Size of array(aName)>0)   
For ($k;1;Size of array(aName))     
aName{$k}:=””  
End For
End If

If you need to execute statements requiring either loop or conditional structures, you should create a procedure within your 4th Dimension database to perform the action and call the procedure from SuperReport Pro by entering the procedure name within the script editor window.

The script editor window contains [OK] and [Cancel] buttons. These are used to save or cancel any changes that you make to the scripts. The three icons at the bottom left of the dialogue box window may be clicked on to provide pop-up menus listing the 4th Dimension command set, the file structure contained within Enterprise 6, and a list of variables used within Enterprise 6. Selecting an item from any of these pop-up menus will insert the relevant text into the text above.

Report sections

A SuperReport Pro report document is broken up into different sections. These sections are the Header section, SubHeader sections, Body section, Subtotal sections, Total section and Footer section.

There are six SubHeader sections named SubHeader1, SubHeader2 … SubHeader6 and six SubTotal sections named SubTotal1, SubTotal2 … SubTotal6.

A report always has the following sections; a Header section, a Body section, a Total section and a Footer section. The SubHeader and SubTotal sections are optional and are only used when break processing is to take place - in fact these two types of section are used to define the number of break levels and when the breaks will occur.

The order in which the sections occur on a report is as follows:

  1. Header
  2. SubHeader1
  3. SubHeader2 SubHeader3
  4. SubHeader4
  5. SubHeader5
  6. SubHeader6
  7. Body
  8. SubTotal6
  9. SubTotal5
  10. SubTotal4
  11. SubTotal3
  12. SubTotal2
  13. SubTotal1
  14. Total
  15. Footer

Those sections not shown in bold are optional and are not required on a report. The other sections occur on all reports.

When SuperReport Pro is launched and a blank document is displayed, the four standard sections (Header, Body, Total and Footer) are always automatically created.

The Header section marker marks the bottom of the header section of the report. Everything from the top of the page to the Header section marker is in the Header section. The Header section of the report and the objects within that region are printed at the top of every page that is generated by SuperReport Pro.

Similarly, the region between the Total section marker and the Footer section marker and the objects contained within that region are printed at the bottom of every page that is generated. A section region is bounded at its bottom by the section marker of the same name, and at the top by the section marker above.

In the example above, the Body section of the report is the region between the Header section marker and the Body section marker and it contains two fields, [Companies]Company Code and [Companies]Company Name.

Where are the sections used in the printed report?

The Header section and its objects (those contained within the section) are printed at the top of every page of the report that is generated by SuperReport Pro.

The SubHeader sections SubHead1, SubHead2 … SubHead6 are described later.

The Body section and its objects are printed for each iteration, or for each record of the selection that is processed.

The SubTotal sections SubTotal1, SubTotal2 … SubTotal6 are also described later.

The Total section and its objects are printed after the final iteration, or after the last record in the selection and its Body section has been printed. The Footer section and its objects are printed at the bottom of every page of the report that is generated by SuperReport Pro.

Moving the sections

To move a section marker, either click on the section marker’s line, or on the rectangle that contains the section’s name. SuperReport Pro will allow you to move the section horizontally without restriction, and vertically up as far as the section marker above, and down as far as the section marker below. You are not able to move the Body marker above the Header marker, nor below the Total marker.

If you hold the <Shift> key while dragging the section markers, then ALL the sections markers beneath the selected one will be moved in sympathy with it. For example, dragging the Body section marker while holding the <Shift> key would cause the Total and Footer markers to move in sympathy.

Selecting the ‘Position Sections…’ command from the SuperReport Pro Edit menu will produce a dialogue box that allows you to quickly set the horizontal position of the section marker rectangles (these contain the section name). Using the dialogue box, you may place the section marker rectangles at the left of the editor area, staggered across the editor, or at the right hand edge of the editor area. This facility is useful if you find the section markers obscuring parts of the report.

You can also show or hide the sections using the ‘Show Sections’ command on the SuperReport Pro Options menu. The ‘Lock Sections’ command on the Options menu is used to prevent the sections from being moved or modified by accident. Creating and deleting subheader and subtotal sections To add or delete sections use the ‘Add/Delete Sections…’ command from the SuperReport Pro Edit menu. Using the dialogue box that appears, you are able to add or remove sections by checking the appropriate check boxes.

Break Processing

SuperReport Pro’s break processing capability will enable you to print report subheadings, subtotals and grand totals for the entire record or array selection to be printed provided that the record or array selection is sorted appropriately.

Assume the following record information sorted alphabetically by region, and by customer name within region:

[COMPANIES]Company [COMPANIES]Area [COMPANIES]Sales

Fruit International Central 15,000

Flans & Pies London 100,000

SafeMarkets London 85,000

London Pride West Country 8,000

London Pride Ventures West Country 25,000

Sarah’s Sandwich Stop West Country 156,000

And that a report is required in the following format:

Area Central Fruit International 15,000

_____Total for Area Central 15,000

Area London

Flans & Pies 100,000

SafeMarkets 85,000

_____ Total for Area London 185,000

Area West Country

London Pride 8,000

London Pride Ventures 25,000

Sarah’s Sandwich Bar 156,000

_____ Total for Area West Country 189,000

_____ Grand Total 389,000

A SuperReport Pro report that would produce the above printed output would require only a single break level using both a SubHeader1 section and a SubTotal1 section.

The record selection also needs to be sorted on the [COMPANIES]Area and [COMPANIES]Company fields prior to the report being printed otherwise the break processing will not function correctly. This can be done by creating a Start Script for the report to sort the selection using the following code:

SORT SELECTION([COMPANIES];[COMPANIES]Area,>;[COMPANIES]Company;>)

The maximum number of SubHeader and/or SubTotal sections indicates the number of break levels that are to be used - one in this case, since there is a maximum of one SubHeader, and/or a maximum of one SubTotal section. If there had been one SubHeader section used, but two SubTotal sections, then there would have been two break levels.

The last thing that remains when creating this report is to indicate to SuperReport Pro the field value that SuperReport Pro is to “watch” in order to generate the correct SubHeader and SubTotal sections. The field value (in this example) that determines when to generate the appropriate SubHeader and SubTotal sections is the [COMPANIES]Area field - whenever its value changes, SuperReport Pro will generate a break level. Setting the field or variable that SuperReport Pro is to “watch” in order to generate breaks is described below.

Setting a subHeader or subtotal section’s breaking value

In order to make use of SuperReport Pro’s break processing capability, you must define the field or variable that SuperReport Pro is to “watch” for each of the break levels (SubTotal1, SubTotal2 etc).

You can define the “breaking” field or variable name in either the SubHeader section, SubTotal section or in both sections. When SuperReport Pro calculates the number of break levels, and the “breaking” field or variables names for each level, it checks the SubTotal sections first, and then the SubHeader sections. The reason that you can define the “breaking” field or variables names in either the SubTotal section or the SubHeader section is because you may have a report that uses only SubHeader sections or SubTotal sections, or a mixture of the two.

In the example above, if no subtotals for the sales figures was required, but a breakdown of the customers by regions was, then only the SubHeader1 section might be defined - there would be no need for the SubTotal1 section. To set the breaking field or variable name that SuperReport Pro is to “watch”, either double-click on the section marker, or select its name from the hierarchical menu that appears when you select the ‘Modify Section’ command on the SuperReport Pro Edit menu. This will produce the Section Options dialogue box shown below. To set the breaking field or variable name select the Only Use This Section On Value Changes Of… radio button. Clicking on the pop-up menu to the right of the text “Object” will allow you to specify whether the object to be “watched” is a field, a variable or an array variable. To select the field or variable name, click on the small pop-up menu icon between the text “Name” and the entry field that contains the field name. Doing so will produce a pop-up menu listing the available fields or arrays depending upon which object type you have selected. You are also able to enter the name directly into the entry field if you so wish.

As SuperReport Pro processes the report, it will “watch” each of the specified breaking fields or variables, and will generate a break (and print the appropriate SubHeader and SubTotal sections) when it detects that its value has changed.

Setting the section options

To display the Section Options dialogue box, either double-click on the section marker within the report, or select its name from the hierarchical menu that appears when you click on the ‘Modify Section’ command on the SuperReport Pro Edit menu. If the section you wish to modify is disabled on this hierarchical menu, then this is because it has not yet been defined on the report.

For example, if you have a single break level because you have only created a SubHeader1 and a SubTotal 1 section, then the SubHeader2 … SubHeader6 and SubTotal2 … SubTotal6 menu items will be disabled. The section options dialogue box will then be displayed. A complete description of setting the breaking value is described above in the section ‘Setting a SubHeader or SubTotal Section’s Breaking Value’.

The Section Options dialogue box also allows you to control page breaking. Using the Page Breaking Options radio buttons, you can determine whether the current section is to be printed on the current page, or whether a new page is to be generated before or after the current section is printed. The Adjust Section At Print Time For Clipping Margin check box is only used for the Footer section. Checking this option causes SuperReport Pro to automatically “lift” the footer section area, when it is printed, above the clipping margin at the bottom of the page. This feature is useful since it means that you can define the height of your Footer section to accommodate your footer objects without having to calculate the additional height required to allow for the clipping margin. If you do not set the Adjust Section At Print Time For Clipping Margin check box then the footer objects will be printing within the page’s clipping area - ie they will not be printed. If however the Adjust Section At Print Time For Clipping Margin check box is set then the Footer section will be increased in height by the size of the clipping region at the bottom of the printed page causing the footer objects to be printed above the clipping boundary as you would expect. If you have defined your report in terms of the physical page and if you do not set the Adjust Section At Print Time For Clipping Margin check box then you will have to set the Footer section height tall enough to accommodate both the printer’s clipping margin and the objects that you wish to place in the footer area of the report.

Section scripts

SuperReport Pro allows you to attach an object script to any defined section.

To access the script editor window, click on the [Script…] button in the Section Options dialogue box. If the section already has a script associated with it, or if you create a new script for the section then the text of the [Script…] button will be preceded by a tick mark. The tick mark is a quick way of seeing that an object has a script associated with it. When an section is viewed on the report page, it is also possible to tell whether it has a script attached to it or not.

In the example below, the upper section marker has no script attached to it, while the lower one does - the inverted triangle at the right hand side of the marker denotes that the section has a script attached to it. When the report is generated, section scripts are executed “just before” their objects are printed on the report. For example, if a Body section of a report has a script attached to it, and the report prints the Body section five times (because the report is printing a selection of five records), then the section script will be executed five times - each time prior to the section’s object being “printed” on the page. Section scripts like object scripts can be used to make selections of records in other files, to fill variables with data, or to perform any other action that the 4th Dimension command set will allow. The script editor window that the [Script…] button produces is described in more detail above.

Rulers and guides

The SuperReport Pro editor has a ruler that can be made visible or invisible using the ‘Show Rulers’ command on the SuperReport Pro Options menu. When the rulers are active then the menu command will be preceded by a tick mark. You may only create new guides on the report when the ruler is active - this is described in greater detail below. When a new SuperReport Pro document is created and displayed, the ruler defaults to points. The current unit type displayed on the ruler is indicated by the ‘Ruler Units’ hierarchical menu display on the SuperReport Pro Options menu. Clicking on the menu produces a units pop-up menu from which you are able to select three possible unit types: Points, Millimetres and Inches.

Creating a new guide

SuperReport Pro allows you to make use of up to four horizontal and four vertical guides on a report.

Guides are used to help you align objects on the report. They may be made either visible or invisible using the ‘Show Guides’ command on the SuperReport Pro Options menu. Guides can only be created when the rulers are shown. To create a new horizontal guide click in the horizontal ruler at the bottom of the SuperReport Pro editor area and drag a new guide onto the report. As you drag the new guide the cursor will change to the guides cursor. Similarly, to create a new vertical guide click in the ruler at the right hand side of the editor area, and drag a new vertical guide on to the report. If there are already four horizontal guides on the report, you will be unable to drag a new horizontal guide. By the same token, if there are already four vertical guides on the report you will be unable to drag a new vertical guide.

Moving a guide

To move a guide, click on it and drag its outline to a new position.

Deleting a guide

To delete a guide (either horizontal or vertical), click on it and drag it off the report editor area - this will cause SuperReport Pro to remove the guide from the report.

Report scripts

The ‘Scripts’ menu item on the SuperReport menu produces a hierarchical menu listing three menu items.

These items correspond to the three types of script that SuperReport is able to execute as the report is generated. †The Start Script is executed before the report is generated - this procedure is normally used to load a selection of records and to sort them prior to printing. In Enterprise 6, these tasks will normally be performed by the selected ‘View…’ function and the buttons palette prior to the loading of the SuperReport Pro window, so Start Scripts will be little used.

In the case of SuperReport forms, Start Scripts are used to load information into the variables used by the form.

The Body Script is executed as each record (or element of the array) in the current selection is processed - this procedure is normally used to load related records, or to query and sort for a selection of records in another file.

The End Script is called when the report has finished printing - it can be used to clear arrays of variables that where used or to reinstate the record selection in force before SuperReport Pro generated its report. If the ‘Script’ menu item is preceded by a tick mark, then this means that the relevant script is active and contains 4th Dimension statements, and will be executed at the appropriate time during report generation. If the menu item is not checked then there are no 4th Dimension statements for that procedure and SuperReport Pro will not execute any code.

These three SuperReport scripts are analogous to 4th Dimension’s report layout phases - the Start Script is equivalent to the Before Selection phase, the Body Script is equivalent to the Before or During phase, and the End Script has no equivalent phase. Selecting any of these menu items will produce the script editor window which is described above.

Note that not all 4th Dimension commands can be used in Scripts. If statements cannot be used, for example. However, it is possible to write a single line script which calls a Macro. Macros can feature any 4th Dimension command, including conditional, looped or nested commands, in addition to any Macro Language command.

To do this, in the Script of an object in the body phase, simply type: Macro ("MACRO CODE") where ‘Macro Code’ is the Macro Code of the Macro that you wish to be run. That Macro must be a ‘Same Process’ Macro. Page Numbers A ‘Page 1 of 2’ label can be added to SuperReport Pro reports and forms. To do so, you need to create Scripts to calculate the number of items shown in the report. That number should then be divided by the number that fit on the page (which will vary according to your design). In the Start Script add a line that reads: vPage:=0 Then add a variable to the report called ‘vPPage’ and edit its Script to read: vPage:=vPage+1 vPPage:="Page "+String(vPage)+" of "+String(Int(Size of array(SRDesc)/24)+1) The number of items per page is here assumed to be 24. You can copy this variable (with its Script) from report to report, but remember to change the 24 to the relevant value, as determined by your design. If you want the variable to read something different or to disappear if there is only one page, you will need to amend the Script as follows:

If ((Int(Size of array(SRDesc)/24)+1)=1)        

vPPage:="Only Page"      `or "" for nothing

Else        vPage:=vPage+1        

vPPage:="Page "+String(vPage)+" of "+String(Int(Size of array(SRDesc)/24)+1)

End if

This will print ‘Only Page’ in place of ‘Page 1 of 1’. Again, the example caters for a form with 24 items per page.

 

Using macros in superreport forms

Creating a column

The following is an example of creating your own column within a SuperReport version of a Enterprise 6 Form. In this case the Macro (which must be a ‘Same Process’ Macro) should be run from the Start Script of the SR Remittance, and uses an array (named ‘mSROther’) to identify whether each item is a pre-payment or a normal Invoice. The Macro Text reads as follows:

mSize:=Size of array(SRProdCode) `Learns how many times to run this

For loop ARRAY STRING(11;mSROther;mSize)

For(mCount;1;mSize)    

If(SRProdCode{mCount}="*@")          

mSROther{mCount}:= "Pre-Payment"   

Else          

mSROther{mCount}:= "Invoice"   

End if

End for

The mSROther array should be placed in the Body area of the Remittance form using the Variable tool. Select “Array (Automatic)” in the Type pop-up menu in the resulting dialogue box. Then, click [Repeat…] and ensure that the ‘Repeat this Object’ radio button is switched on. Also, switch on ‘Use Vertical Repeat Offset’ and set it to 2 points. There is no need to type the {} suffix as part of the array name: this will be done for you.

Showing or hiding discounts

SuperReport Forms can include a column called ‘SRDisc’ which will show the discount applied to an Order Item. However, if the column is devoid of discounts its presence alerts the recipient to the fact that you sometimes offer discounts but are not doing so on this occasion. An alternative is call a Macro from the Start Script of the Form by inserting the following line: Macro("ShowDiscount") †The Macro itself adds the text “@  x% Discount” to the Product Name of any items featuring a discount. It reads as follows:

mSize:=Size of array(SRProdCode) `Learns how many times to run this

For loop

For(mCount;1;mSize) `Loops through each element of the array  

If(SRDisc{mCount}#0) `If there is a disocunt to add  

SRDesc{mCount}:=SRDesc{mCount}+" @ "+String(SRDisc{mCount})+"% Discount"  

End if  

End for

Printing the report

Printing the report is facilitated by simply selecting ‘Print’ from the SuperReport Pro File menu. After the usual Print Settings windows have been considered, the report is printed. Below are described the further print options available.

Print preview

Selecting the ‘Print Preview’ command from the SuperReport Pro File menu will cause SuperReport Pro to preview the report within the SuperReport Pro editor area. The area will change providing you with a new toolbar containing page navigation buttons, a [Print] button and a [Done] button (used to return to the report editor). As SuperReport Pro previews the report, a thermometer provides an indication of how far through the record (or array) selection the preview has progressed. The preview stops as each page is generated, and you need to select the [Next Page] button (third icon from the left) to generate the next page.

Using the other navigation buttons, you can step backwards and forwards through the generated pages. The page navigation buttons can be activated using the <Command> (Macintosh> or <Control> (Windows) key and the arrow (cursor) keys. The [Print] button prints the current viewed page.

If you need to print all the pages, terminate the preview using the [Done] button (containing a ‘cross’), and print the report normally using the ‘Print’ command from the SuperReport Pro File menu. If you click within the ‘mini’ printed page (in preview mode), SuperReport Pro will ‘zoom’ the page to 100% allowing you to see the report page as it would print. Using the scroll bars, you are able to move the page around. You can also hold down the and <Command> keys (Macintosh) or <Alt> and <Control> keys (Windows), and drag the page using the mouse.

If you find that the preview produces no visible output, then make sure that you have one or more items in your current selection for printing. If not, you can use the ‘Select Records…’ command from the SuperReport menu. Also ensure that you have defined your report correctly, with the sections in the appropriate place.

Print to disk

This facility is provided to allow you to create export documents on disk using SuperReport Pro. The output is in the form of an ASCII file.

Selecting ‘Print to Disk’ from the SuperReport Pro File menu will cause SuperReport Pro to display the following dialogue box displaying the output options available to you. Using the dialogue box, you are able to select the sections for printing - normally you would only print the Body section, however you do have the option to print all the sections (as defined in the ‘Select Printing Sections…’ dialogue box).

The Print Static Text Items check box allows you to either print or suppress static text (such as headings etc.) depending upon whether you check the check box or not.

Using the Between Fields and End Of Record edit fields, you can specify the ASCII value of any character that you wish to have printed between fields, and sections. By default, these are the Tab and Carriage Return characters (respectively).

If you select the [Print] button, SuperReport Pro will prompt you to create a document. If you do not create a document using the standard save file dialogue box, then SuperReport Pro will not print the report to disk. If you do create a document, then SuperReport Pro will print the report to disk in your specified document.

Selecting printing sections

Generally you will always print the sections that you have defined on your report. However, SuperReport Pro has a very useful feature that allows you to “switch off” certain sections suppressing them from the printed output even though they are defined on the report.

This feature is most useful for reports that make use of break processing where you want to design a single report, but need to print it either with or without the Body section. This allows a single report to be printed as two different reports; a detailed report, or a summary report only.

Note that even when sections are “switched off”, all the object and section scripts within that section are still executed at print time. Prior to printing, select ‘Select Printing Sections…’ from the SuperReport menu. At the following dialogue box, illustrated below, check the sections which you need to print.

Printing a SuperReport using macros

A command is available which, if included in a ‘Same Process’ Macro, will print a specified SuperReport containing information from a specified File. The command and syntax is as follows:

SR Print ("Companies";"Co Rep 1";1)

The first parameter contains the name of the File to be printed - in this example the Companies file. The second parameter is the Code of the SuperReport that you want to print. If either of these is specified incorrectly a warning will appear.



 

Published date: v1.1.1.1 Tue, 20 Feb 2007 05:55:10 GMT

© 2006 - 2007 Daybook Limited, All trademarks accepted. All Rights Reserved!
Site Index