21.2 Create the Data Model with Two Linked Queries

The steps in this section will show you how to build a simple data model with two queries in a master/detail relationship.

To create a data model

  1. Launch Reports Builder (or, if already open, choose File > New > Report).

  2. In the Welcome or New Report dialog box, select Build a new report manually, then click OK.

  3. In the Data Model view that displays, click the SQL tool in the tool palette, then click in an open area of the Data Model view to display the SQL Query Statement dialog box.

  4. In the SQL Query Statement dialog box, type the first SELECT statement:



    You can enter this query in any of the following ways:
    • Copy and paste the code from the provided text file called suppresslabels_code.txt into the SQL Query Statement field.

    • Click Query Builder to build the query without entering any code manually.

    • Type the code in the SQL Query Statement field.

    Also note that if you have not installed the Pictures table into the sample schema, you will not be able to create this query.

  5. Click OK.


    If you are not already connected to a database, you will be prompted to connect to the database when you click Query Builder or Next. Ensure that you connect to a database that has the appropriate schema for this example. Section 21.1, "Prerequisites for This Example" describes the sample schema requirements for this example.
  6. When the query displays in the Data Model view, right-click the query name (Q_1), then choose Property Inspector from the pop-up menu to set the following property:

    • Under General Information, set the Name property to Q_DEPT.

  7. Follow the steps above to create another query named Q_EMP, with the following SELECT statement:

  8. In the Data Model view, click the Data Link tool in the tool palette.

  9. Drag a link between DEPTNO in Q_DEPT and DEPTNO1 in Q_EMP. Your data model should now look like this:

    Figure 21-2 Data Model view of the Suppress Labels report

    Description of Figure 21-2 follows
    Description of "Figure 21-2 Data Model view of the Suppress Labels report"

  10. Save your report as suppresslabels_your_initials.rdf.