33.3 Create a Data Model With a Data Link

When you create a report with multiple queries, it is typically easier to create all of the queries with the Data Wizard in the Data Model view. In this report, you will create two queries, linked with a group-to-group data link.

This query joins the Orders table to the Customers table for customer information and sales representative information.

Note:

You can enter this query in any of the following ways:

Copy and paste the code from the provided text file called invoice_code.txt into the Data Source definition field.

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

Type the code in the Data Source definition field.

Click Next.

Note:

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 33.1, "Prerequisites for This Example" describes the sample schema requirements for this example.

On the Groups page, click Next.

Click Finish to display your first query in the Data Model view.

Repeat the steps above for a second query, but this time name your query Q_Item and use the following SELECT statement:

Click and drag from the ORDER_ID column in the G_ORDER group to the ORDER_ID1 column in the G_LIST group. Notice that a line is drawn from the bottom of the G_ORDER group to the Q_Item query. Labels for ORDER_ID and ORDER_ID1 are created at each end of the line to indicate they are the columns linking G_ORDER to Q_Item.

Scripting on this page enhances content navigation, but does not change the content in any way.