| MERGe is the report generator for MaxBase. It is quite capable, being able to print on paper, draw on screen, create HTML tables, generate NetRexx and Java code to reproduce reports in your code. You can use it as an user and as a developer tool. NOTE: MERGe will act differently if you load it as a standalone program (MERGe can be started by typing 'java nrio.reports.MBReport' at a command prompt) as opposed to calling it from MaxBase. If you load it from MaxBase while a database is loaded, MERGe will be set up using current MaxBase database (and query) information and it will not allow you to change DB, while if you load MERGe by clicking on its own icon you will be able to load any DB you like. See MERGe in action: |
| MERGe is built to act like a "wizard", a notebook that will produce output after you've customized its parts. Summary: Setting generic options. Setting page setup options. Choosing records to print. Line-view reports. Form-view reports. Printing. Setting generic options The first page (labeled OPTIONS in the tab) is divided in two parts: the upper is used to load and save report-related files (MaxBase line mode reports are files which end with the .lmr extension, page layout information is saved with the .rps extension, while forms have the .mfr extension), the lower is used to choose paper size and resolution. Please note that you need a JVM at least at the 1.1.5 level in order to see correct paper size, since there was a bug in the 1.1.x series prior to 1.1.5. NOTE: when you load a report and you have launched MERGe from MaxBase, database information will continue to be taken from MaxBase. In that case you will only be loading color information and, if the number of fields is the same, field names. |
| Setting page setup options. If you want to customize the page setup, switch to the second page of MERGe before actually printing the report. A new tabbed interface will let you customize margins, header, footer and so on. Let's see how. In the first page you can set the margins, by filling in the text fields. |
| In the second sub-page, you'll find the options for including an image in your reports. You can tell MERGe to use the image as it is (centered), scale it to fit the whole page (maximized, retaining the original aspect ratio), or tile it (tiled). |
| A neat feature is that MERGe will try to load the image as you type the path (if you don't choose to browse directories using the "browse" button). In the last sub-page there are all of the remaining options for page setup: |
| Beside the usual widgets that let you customize fonts, alignment and colors, you will find in this page two text fields that let you enter the text of the page header and footer. Three macros are available (as you can see from the picture): $D will be expanded into the current date and time. $P will be expanded into the currently being printed page. $T will be expanded into the total number of pages. Choosing records to print. In the third page (labeled RECORDS) you will find information about the database. If you are using MERGe standalone you'll be able to load a database from which to get the records and fields information, otherwise you will only be able to issue a new query (a query is the same thing as a MaxBase filter). You can order the database and issue a query using the buttons and textfields in this page: in order to select only some records, enter a query in the editable text field and press the "query" button. The syntax for queries is the same of that for filters in MaxBase. |
| Once you've chosen your printer, database and so on, you can switch to the third page (LINE VIEW) or the fourth one (FORM VIEW), where you can visually compose your report. LINE VIEW REPORTS The main component of this page is a yellow list that holds eight names. When you click on one of them, you can use the color and font customization widgets to make it appear as you want. Beware that you have a lot of freedom in doing so. For example, by making horizontal record lines invisible or vertical record lines invisible, you'll get two very different looking reports. |
| From this page you can also control the visual appearance of fields, with the field arrangement dialog or by using the controls in the lower end of the window. Change alignment, maximum length, order and hide or show whatever field you want. As a visual cue to help you understanding how big will your report be, you will have two widgets in the very bottom of the page that show maximum record width and number of pages. Maximum record width is a measure of how large your report could be, if your records used up all of the estate available to them (most fonts are proportional, so actual width may vary depending on which characters are present in a record). If this value is painted in red, it means that you may exceed paper width, if it is in blue it means that you're ok, no matter what. Number of pages obviously tells you how many pages long will your report be. When you are done editing things, you have three choices: source code, preview and print. Source code brings up a dialog that lets you select a language in which to translate the report, and optionally save the report/select it for you to place it in the clipboard. |
| To make it work, you should select a language and then press "refresh". Then you can edit the output and copy it into the clipboard or save it in a file. Please note that HTML output is very different from Java and NetRexx output. HTML source produces an HTML table (complete with color and field information) to be used in your web pages, while the other two create Java or NetRexx code that you can reuse in your programs to reproduce a report exactly as it is. Preview does actually what it says: it prints your report on screen, so you can peruse it before printing it. On the top of the page you can find a list from which to select a page to be displayed. Note: The size of the window is set to be the same as the size of the paper that will hold the print. FORM VIEW REPORTS Forms created with the Visual Form Designer can be used, other than for data entry, also for printing. You can therefore print labels, invoice forms, estimates and so on, with ease. The first thing to take into account is that forms are created with a precise size, and if you want to get a sharp print you shouldn't scale them excessively. A form created with a 640x400 (pixels) size shouldn't be scaled down to 320x200; if you want to print 320x200 forms, create them with a similar size in the VFD. A useful tip to create nice reports is the following: you don't have to use the same forms for printing and entering data. FreeText and FreeTextArea components, the most common components in forms used to do data input, don't scale nicely. If you need to preserve text readability, create a form that's about the size of the form you are going to print, and use DescLabels instead of FreeText components (DescLabel font size, in fact, can be specified by the user, while most JVMs don't allow this for the common text fields and therefore you can't choose font size for FreeText components). Printing resolution is also greatly affected by both the resolution of your printer, and the JVM you are using. As an example, the Sun JVM for Win32 (up to the current 1.1.7) always prints using a 72 DPI resolution, no matter what you specify in the printer options; this means to you that you should definitely experiment and tweak in order to understand how to make things look nice. It is certainly possible to make things look nice! The options available to print form view reports are the following: [ Form size ] This option allows you to scale up or down your image before printing it. You can scale it using pixels, millimeters or inches as measurement units. [ Form default colors ] The VFD doesn't save form colors, since they are overridden by MaxBase colors; with this option you can specify your own colors or just leave the default (which prints using a white background and a black foreground). Note: The form color differs from the page color, because you can print several forms into a single page. If you need to change the page color, please do so on the "page setup" section of MERGe itself. [ Form copies ] Usually you don't need to change this, but if you want to print a precise number of forms in a page, you can do so using these controls. Warning: using this option, you have absolute control on the number of forms that will be printed: if the forms exceed page size, they will not be cut. After you have set all the options you needed to set, you can preview or print pages. Please remember that printing and previewing form view reports is a very CPU-intensive task, and therefore you may have to wait some time before a page is rendered on screen and/or printed. Also please note that in order to print or preview form view reports you have to have set up correctly page size in the `Optionsī panel. |
| Printing Finally, you can print your report. This button (available from both LINE VIEW page and FORM VIEW page) brings up a dialog that lets you select which pages to print, and in which order. Basically you must select the page(s) you want printed, and then push on "print". Some buttons are available to automatically select odd/even/all pages, or to clear the current selection; you can also print in reversed order. NOTE: Why to print odd or even pages? If you have a printer that can't print on both sides of the paper, this option will help you speeding up the printing process: if you print all of the odd pages, then take the printed pages out of your printer, flip them frontside back, put them back in the paper feed tray, then choose to print the even pages, you will have printed everything in the correct order. |