Table of Contents
Report Editor - Table : Map By Parameters Help
Using the Map Parameters dialog, you can set correspondence between records, returned by the query of the report, and records, returned by the query of the table limited by the condition with parameter.
- Parameter – The name of parameter in the query of the table.
- Expression – The expression, that should be substituted instead of the parameter.
- Description – The description of the parameter.
When the map of parameters is defined, the table control will show records of the table query, that returned after substitution the results of evaluated expressions instead of parameters. These expressions are evaluated for the current record of the report.
Let you have a database with tables Customers and Orders:
As an example, we will create a report, that will print a list of customers, and a table of payments for each customer.
- Create a parametrised query for report with the list of payments for particular customer.
SELECT * FROM payment WHERE customer_id = $P(param_customer_id)
Like it is shown on the following pictures:
- Create a query for report with the list of customers.
SELECT * FROM customer
- 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 Reports
If you preview this report now, you'll see that payments of the customer with the default value of param_customer_id parameter are printed next to the names of all customers. Let's fix it.
Now you need to bind data in the table to the data in the report using the map of parameters. For this - select property map_parameters in the Properties Inspector (click an 'edit' button for the property to open the dialog with the map of parameters). To make the relation between data in the table and in the report - set the expression for parameters of the table query. As shown on the images below:
That's all! Data is bound. To check it go to the preview mode of the report:
The table prints records that corresponds to the map of parameters.