Referencing Parameters in a Join Condition
Using parameters in join conditions of data source pre-joins and query joins can dynamically change query results at runtime. It works similar to query filters. In a join condition, you can select a parameter, or manually input a parameter name in the format @ParameterName or :ParameterName. See the following example.
- Open the catalog file SampleReports.cat in
<install_root>\Demo\Reports\SampleReports
. - In the Catalog Manager, create a type-in parameter in Data Source 1, which is named pCountry of String type with two values: Canada and Italy.
- Right-click the ShipmentDetailsbyCustomer query in Data Source 1 and select Edit Query.
- In the Query Editor, double-click the join icon in the join line.
- In the Join Options dialog, select Add Condition to add a new condition line. In the second condition line, select the first to select the Country field by double-clicking it from the Values dialog, then select the second to select the parameter pCountry. Select OK in the Join Options dialog.
- Select OK in the Query Editor and then save the catalog.
- Create a page report based on the ShipmentDetailsbyCustomer query in Data Source 1.
- View the report result and you will be prompted to enter the parameter value for pCountry. Select Italy and the report shows only data of Italy.