The following are the steps for creating a new report:
13_Adding_Subreports.prpt
. We create a JDBC data set and configure it as follows:sakila db
CountryCity
SELECT DISTINCT country.country_id, country.country, city.city_id, city.city FROM country INNER JOIN city ON city.country_id = country.country_id INNER JOIN address ON address.city_id = city.city_id INNER JOIN customer ON customer.address_id = address.address_id INNER JOIN rental ON rental.customer_id = customer.customer_id WHERE country.country_id = ${SelectCountry} ORDER BY country.country
ListOfCountries
SELECT DISTINCT country.country_id, country.country FROM country WHERE country.country_id IN (20,24,29,34,48,67,74) ORDER BY country.country
Now we configure the Parameter as follows:
SelectCountry
Country:
Number
20
; this value is arbitrary and represents CanadaTrue
Drop Down
country_id
country
Now we will recreate the layout of the following image. After doing this, we will be ready to start the interesting part of this chapter, Subreports!
Adding Subreports
.city
, and, as before, we configure their formats and colors. We should also expand the area of this section, as this is where we will add our second Subreport.[country_id]
We created a new report and named it 13_Adding_Subreports.prpt
. We created a JDBC data set and configured its connection and SQL query so that it returns the countries and cities where films have been rented. We created and configured the Parameter SelectCountry. The layout that our report should have was presented, and with this in mind, we took the necessary steps to adapt our report to the guide's requirements.