> ### Task 1: Set up and query the data source

> Before you start to design a chart, you must create a report design file for the chart, then set up the data source and data set that the chart uses. These tasks are discussed in detail in earlier sections of this book and in a tutorial in which you build a sample report. This tutorial builds on that knowledge. This task shows how to select the data to build a sample pie chart.

> 1 | To create a new report, choose File→New→Report.

> 2 | Name the new report design Chart.rptdesign. Choose Finish.

> 3 | Build a data source using the sample database, Classic Models.

> 4 | Build a data set for the chart. Use the following data set name:

> ChartData
> Use the following SQL SELECT statement:

> SELECT Products.ProductLine,
> sum(OrderDetails.QuantityOrdered)
> FROM OrderDetails,
> Products
> WHERE Products.ProductCode=OrderDetails.ProductCode
> GROUP BY Products.ProductLine
> ORDER BY Products.ProductLine
> This SELECT statement obtains values from the ProductLine column in the Products table, groups the results by product line, and calculates the sum of the order quantities for each group.

> 5 | Choose Finish, then Preview Results to validate the query. By creating the SELECT statement correctly, you see the data shown in Figure 13-1.

> Figure 13-1 Previewing the data set
> The first column lists product line names. The second column shows the total orders for each product line. BIRT uses sequential numbers to name generated columns, such as the sum column named 2 in Figure 13-1.

> 6 | To rename the sum column to be more descriptive, choose Output Columns. Select column 2, then choose Edit. In Edit Output Columns, use the following settings:

> 1 | In Alias, type:

> TotalOrders

> 2 | In Display Name, type:

> TOTALORDERS

> 3 | Choose OK.

> 7 | To close Edit Data Set, choose OK.

(c) Copyright Actuate Corporation 2013