The master/detail report pattern is used to display information in two database tables that share a one-to-many relationship. Typically the user is shown
a list of the master records and can pick one to view the corresponding detail records. Consider the Northwind database that models product information using two
tables, Categories and Products, where each product is assigned to precisely one category. Categories represent the master
records and products the detail records. In a master/detail report, the user would choose a category to see the products that belong to it.
Imagine, however, that instead of letting the user pick one category we needed to let them pick any number of categories and then show the products
that belonged to any of those selected categories. SQL includes an IN keyword that
can be used to return detail records within a set of master records. Unfortunately, there are challenges using the IN keyword with values
supplied at runtime. The good news is that with a little bit of work, we can overcome these limitations.
This article is the first in a two-part series that looks at displaying detail records from a set of user-selected master records. This first part
looks at extending the IN keyword functionality to allow for the parameters in the IN keyword to be supplied at runtime.
The second part shows how to save what master records the user wants to search on by default and how to have these selections automatically applied when
visiting the report page. Read on to learn more!
Read More >
