> Task 4: | Build a data set

> Now, you are ready to build your data set. A data set identifies the data to retrieve from the data source. If your report connects to a JDBC data source, you use a SQL SELECT statement to identify the data to retrieve.

> 1 | In Data Explorer, right-click Data Sets, and choose New Data Set from the context menu.

> 2 | On New Data Set, in Data Set Name, type the following text, as shown in Figure 1‑11:

> Customers

> Figure 1-11 | New Data Set

> 3 | Use the default values for the other fields.

> n | Data Source shows the name of the data source that you created earlier.

> n | Data Set Type indicates that the data set uses a SQL SELECT query.

> 4 | Choose Next.

> Query displays the information to help you create a SQL query. Available Items lists all the tables in the Classic Models database. You can click the plus (+) sign next to a table to display the columns in the table. The text area on the right side of this dialog shows the required following keywords of a SQL SELECT statement:
> select
> from

> 5 | In the text area, type the following SQL SELECT statement to specify the data to retrieve:

> select customerName,
> contactLastName,
> contactFirstName,
> phone
> from Customers
> Although the data set editor shows table and column names in uppercase letters, you can type these names in the case you prefer because SQL is not case‑sensitive. If you do not want to type the query, you can drag columns and tables from Available Items to the text area.
> The SELECT statement that you created, which is shown in Figure 1‑12, gets values from the CUSTOMERNAME, CONTACTLASTNAME, CONTACTFIRSTNAME, and PHONE columns in the CUSTOMERS table.

> Figure 1-12 | SQL SELECT statement in Edit Data Set

> 6 | Choose Finish to save the data set. If you typed the query correctly, Edit Data Set appears. If you made a mistake, an error message appears before Edit Data Set opens. Edit Data Set displays the columns you specified in the query, and provides options for editing the data set, including correcting typing errors in the query.

> 7 | Choose Preview Results to make sure the query is valid and that it returns the correct data. If you typed the SELECT statement correctly, you should see the results that are shown in Figure 1‑13. These are the data rows that the query returns.

> Figure 1-13 | Data rows returned by a SQL SELECT statement

> 8 | Choose OK.

(c) Copyright Actuate Corporation 2008