### Binding a parameter to a DBField

JReport provides a mechanism which links each field value of a "display column" with the exact value of a "bind column". When you select the field value from the "display column", the field value of the "bind column" is sent to the query to filter the query result.

For example, if you specified customer ID to query data, but you would like to select customer name not customer ID in the parameter specifying dialog which appears at runtime, you can do so by using the functionality - Parameter Binding.

1. Open the demo catalog SampleReports.cat and in the Catalog Browser, expand the data source where to create the parameter.
2. Right-click the Parameters node and then click Add Parameter.
3. In the Create Parameter dialog, enter BindColumn in the Name field, select Bind with Single Column from the Value Setting drop-down list, select Tables and Views from the Source drop-down list, then select Customer ID from the Bind Column drop-down list, and choose Customer Name from the Display Column drop-down list.

   Note: Selecting a display column different from the bind column will establish a link between the two columns (DBFields). When you select the field value from the display column, the corresponding field value of the bind column is actually assigned to the parameter.

4. In the same data source, create a query CustomersInfo on the table Customers. Select all the fields contained in the table.
5. Create a standard banded report based on the query, and have the fields Customer ID, Customer Name, City and Phone displayed in the report.
6. In the Resource View panel, right-click the node that represents the query, and then select Edit Query from the shortcut menu.
7. In the Query Editor, click Query > Filter.
8. In the Search Condition dialog, add a condition for the query as follows (for details, see Filtering with the filter format):

9. Click OK to apply the changes to the query.
10. Click the View tab to view the report. All the customer names will be listed in the Enter Parameter Values dialog. You can select a value from the list to query data with the customer ID instead of customer name.