Switch to: V11V10V9V8V7V6V5

Report Editor - Table : Map By Fields Help

Without the mapping a table control will print all records from the table query, independently from the report query.

Using the Map Fields dialog, you can set correspondence between records, returned by the query of the report, and records, returned by the query of the table.

  • MainReport query fields – Popup menu that contains field names from the query of the report.
  • SubReport query fields – Popup menu that contains field names from the query of the table.

When the map of fields is defined, the table control will show only those records of the table query, where values of mapped fields are equal to the values of the mapped fields of the current report query.

Example

Let you have a database with tables “customer” and “payment”:

As an example, we will create a report, that will print a list of customers, and a table of payments for each customer.

Preparatory Steps

  • Create a query for report with list of customers.
   SELECT * FROM customer
  • Create a query for report with list of payments.
   SELECT * FROM payment
  • Create a report, that will print the list of customers.

  • Insert a table, that will contain the payments of the customers, set a query for it.
  • Define the following layout:

The Binding of Data

If you switch into preview mode, payments table for each customer will contain all records at all. Let's fix it.

Now you need to bind the data in the table to the data in the report, using the map of fields. For this - select property map_fields in the Properties Inspector (click 'edit' button for the property to open the dialog with the map of fields). To bind data in the table and in the report:

  • Set the first item of MainReport query fields to customer_id.
  • Set the first item of SubReport query fields to customer_id.

As shown on the image below:

That's all! Data is bound. To check go to the preview mode of the report:

The table prints records that corresponds to the map of fields.