UPGRADING TEMPLATES FROM FAST-REPORT 2 TO FAST- REPORT 3 |
|||||||||||||||||||||||||||
We recommend that this work is done on a monitor
that has the greatest display area possible. Phase 1Select template Open FR2 template (frf extension) by clicking on the [Print] button while holding the [Ctrl] key on the keyboard down. A screen looking similar to this will open. On the [File] menus select [Save As] and change the “Save as type” to ‘FastReport3 from (*.fr3)’ We also recommend that you add one or more characters in front of the ‘File name’ to make the working template easily identifiable. We used the undescore/underline character which has the further advantage that the template will appear at the beginning of the list. Click on [Save] Close the Save As windows and close the FR2 editor. This completes phase 1 of the process. Phase 2Use the Windows Notepad program to open the template. Use [File – Open] and navigate to the template folder. This is always: {ApplicationDrive}:{ApplicationFolder}\fastreport2\templates\customer\invoice On a single-user system it is most likely to be C:\Technisoft\fastreport2\templates\customer\invoice On a network is is most likely to be Z:\Technisoft\fastreport2\templates\customer\invoice Make sure that the “Files of type” setting is changed to “All Files” and select the saved template.
You will then see something similar to this. Please note that you do not need to understand what it means. From the menu options Select [Edit – Replace] Find: DF_GL.tbl Replace
with: ppx Click on [Replace All] repeat this with: Find: tbl Replace with:
ppx Click on [Replace All] ‘ppx’ stands for ‘pipe to the frxReport component’. Close the Replace windows and save the file using [File – Save] This completes Phase 2 of the process. Phase 3Click on the [Browse button] at the end of the Template field. Select the FR3 template that you saved in Phase 1. The reprint screen will now look like this: Click on the [Print] button while holding the
[Ctrl] key on the keyboard down. Before doing this first you need to set up the FastReport 3 settings. We deal with them at the end of this article so as not to detract from the conversion process. Click on menu option [Report – Data]. Check all the dataset in the list except for the specialist module ones identified by 2 upper case letters at the end. Click the [OK] button. This creates a link between the programs data access components and the report template. Click on menu option [Report – Variables]. Click on the [Category] button. A “New Category 1” appears in the list. Highlight it by clicking and then click again so that it switches to ‘Rename’ mode. Note that even on fast computers there may be a noticeable delay before the second click has an effect. Give the new category a name. We uses “Global” in the above example but could be anything. Click on the [Variable] button. . A “New Variable x” appears in the list. Highlight it by clicking and then click again so that it switches to ‘Rename’ mode. Note that even on fast computers there may be a noticeable delay before the second click has an effect. Create the following variable: copy Click the [OK] button. This has now created a link for the programs to interact with the report template which is not based on any database access. Variables also facilitate report-script based calculations. use [File – Save] to save the template. We now need to find where the script and expressions need to be changed. One way of doing that is to click on the preview button, which will most likely result in an error message with a location indication, fix the problem and then try again. The alternative is to know what to look for and change it. Change to the report script by clicking on the [Code] tab The main windows will then display something like this:
We need to replace all the [] pairs with <> pairs. We have also removed part of the script code. Whereas the FastReport2 engine simply ignored references to non-existing components, the FastReport3 engine throws up an error.
Click on the [Preview] button. Most likely you will get an error similar to: The script code seems to pass but we still have an error in the expression of the Memo25 component on the report. Change to the report template layout by clicking on the [Page 1] tab, and highlight Memo25 in the list. Memo25 will be highlighted by black dots in the components corners. Right-click the component and select [Edit] The following changes need to be made: IF must be changed to read IIF There must only be ONE [] pair and they must be the outermost one. Therefore replace the inner [] pairs with <> pairs. This applies to all expressions. At the same time you may insert some spaces to make it more readable, as we have done in the example below. Click on the [Tick] to save. Click on [Preview] to locate the next problem expression and fix it. Proceed until the preview displays. Some formulations in the page footer totals have been simplified. E.g. [IIF(<PAGE#>=<TOTALPAGES>, <ppxOrh."OH_VATVALUE">, <IIF(<PAGE#><><TOTALPAGES>, '', 0)>)] is now [IIF(<PAGE#>=<TOTALPAGES>, <ppxOrh."OH_VATVALUE">, '')] When you get past the errors with a preview on the screen there won’t be any line items. This is because the conversion process preserves the ‘component connections’ but does not preserve the ‘band connections’. Click on the MasterData band (or select MasterData1 in the components list). In the Properties window the Dataset property to ‘ppxOrh’ (ORder Header PiPe). Click on the DetailData band. In the Properties window the Dataset property to ‘ppxOrd’ (ORder Details PiPe). You should now be able to get a preview although it may look scrambled. In order to fix this close the preview. Select the PageHeader band. Select all the memo components on it (the easiest way is to identify the Shape components, press Ctrl-A to select all, and the deselect the shape components by Shift-Clicking them). Right-click on any of the selected components and uncheck the ‘Stretch to Max Height’ option. Preview and check, if it looks good then we are almost done. Select Page1 in the report components list and set the desired print margins, Bottom, Top, Left and Right. Select Report in the report components list and make sure that ‘Double Pass’ is set to True. If this setting is ‘False’ then .the total page count of multi-page invoices/reports will not be correct. Save the template. This completes the conversion. Report writer settingsOpen an existing template. Select [View-Options]. Below are out standard settings. For the conversion process it is important that the “Free bands placement” option is checked. A Printer-friendly version (pdf) may be downloaded from HERE |