Language:

HansaManuals

Creating a Report Using the Report Generator
Creating a Report Generator Report - Specifying the Primary Register
Creating a Report Generator Report - The Appearance of the Report
Creating a Report Generator Report - Choosing a Print Destination
Creating a Report Generator Report - The Width of the Report Window
Creating a Report Generator Report - Printing the Report
Creating a Report Generator Report - Adding White Space
Creating a Report Generator Report - Adding Searches
Creating a Report Generator Report - Adding a Secondary Register
Creating a Report Generator Report - Using Variables and Formulae
Creating a Report Generator Report - Printing Information from Matrices
   - Linking the Register and its Matrix
   - Printing Information from a Matrix
   - Matrix Rows of Different Types
Creating a Report Generator Report - Bringing Information in from Other Registers
Creating a Report Generator Report - Page Breaks
Creating a Report Generator Report - Filtering Records (Print If)
Creating a Report Generator Report - Adding Check Boxes to the Specification Window
Creating a Report Generator Report - Adding Radio Buttons to the Specification Window
Creating a Report Generator Report - Searching for Records within a Period
Creating a Report Generator Report - Break Points, Subtotals and Totals
Creating a Report Generator Report - Blocks
Creating a Report Generator Report - Syntax
Creating a Report Generator Report - Useful Functions
Example Reports - Listing Sales Figures
Creating a Report Generator Report - Common Error Messages

Tutorials for Standard Accounts

Creating a Report Generator Report - Using Variables and Formulae - Joining Two or More Pieces of Information Together

This page describes bringing several pieces of information together into a single variable which can then be printed in a Report Generator report. This will improve the appearance and readability of the report as it will allow phrases to be printed in the report without unsightly gaps.

---

You can join several pieces of information together in a single variable. This is known as "concatenation". For example, in the Contact Footer section of the example Customer List report that we are using in this documentation, it might improve the appearance of the report if we added the Contact Number or Name to the text "Total for Customer" that is already there. The various pieces of information that you join together must be strings. You can do this using one of two methods:

  1. Declare a string variable at the beginning of the report on the 'Data' card. Then, use the [Code] button to add a line of code that joins the various pieces of information together and places the result in the string variable. Turn to the 'Layout' card and use the [Formula] button to place the string variable in the appropriate section of the report.

  2. An alternative method is to bypass the 'Data' card altogether. Instead, use the [Formula] button to join the various pieces of information together and place the result in the appropriate section of the report. This method is faster to write and means that there are fewer variables in the report. However, by bypassing the 'Data' card you risk making the Report Definition harder to read and edit in future, because code is divided between the 'Data' and 'Layout' cards.
The example shown below illustrates the first method. We have declared a new string variable vsCustText at the beginning of the report. Then we added a line of code to change its contents for every Customer:

The code that joins the standard text ("Total for Customer") and the Contact Number is placed in the Contact register section, so it will be used once for each Contact. Whatever was previously in the vsCustText variable will be lost. The code is:
code: vsCustText="Total for Customer "&vrContact.Code
The standard text including final space is placed in inverted commas "". The standard text and the Contact Number are joined using the ampersand &. You can place a space either side of the ampersand to make the code easier to read:
code: vsCustText="Total for Customer " & vrContact.Code
These spaces will be ignored when the report is printed.

Use the [Formula] button to place the variable in the appropriate section (in this example, in the Invoice Footer section) on the 'Layout' card, in the same way as described on the Printing a Variable page:

If you don't want to use variables (i.e. you want to use the second method mentioned above), simply click the [Formula] button on the 'Layout' card. When the 'Formula' dialogue box opens, type in the code that joins the various pieces of information together. For example, the vsCustText variable and its line of code could be replaced with this formula:

As with the first method, to join several pieces of information together, place an ampersand between each element. The following example will print the word "Customer:" followed by the Contact Number and Name. A comma and space will be printed between the Number and the Name. The word "Customer:" and the comma and space are both fixed text and are therefore enclosed in inverted commas:
"Customer: " & vrContact.Code & ", " & vrContact.Name
Please follow the links below for more details about:
---

Creating a Report Generator Report:

Go back to: