## Lesson 1: Creating new ad hoc reports

The easiest way to create an ad hoc report is to use the report wizard. There are these types of report in the wizard which collects information from you: blank (no component), standard banded, crosstab, table, and chart. You can add components to or remove them from the report after it is generated by the wizard.

This lesson is based on the JinfonetGourmetJava catalog that you have populated and published to \My Reports\JinfonetGournetJava in Trail 4. If you do not complete that trail or do not want to use your own catalog, you can use the version of the JinfonetGourmetJava catalog offered by JReport Enterprise Server.

This lesson contains the following tasks:

- Task 1: Create a banded report
- Task 2: Create a table report
- Task 3: Create a crosstab report
- Task 4: Insert a chart

### Task 1: Create a banded report

In this task, we need to create a new ad hoc report that contains a standard banded object.

1. Start JReport Enterprise Server by clicking Start > All Programs > JReport 9.0 > Server > Start JReport Server.
2. Click Start > All Programs > JReport 9.0 > Server > JReport Server Console, or open a web browser and set the URL to http://localhost:8888.
3. On the welcome page, click the Login Now button.
4. In the Connect to localhost dialog, enter admin for the user name and admin for the password. Then the JReport Enterprise Server Console page appears.
5. Go to the My Reports > JinfonetGourmetJava folder, and then click the Ad Hoc Report link.

6. In the New Report Set dialog, type Customer Orders Report in the Report Title text field, select Standard Banded Report in the layout box, and then click OK.

   The Standard Banded Report Wizard appears.

7. In the Data screen, select BusinessCubeDemo in Data Source 1 from the Data Source list. Click Next.

   An ad hoc report is supported by one and only one business/report cube. The definition of the business/report cube determines what can do on the ad hoc report and typically this information would be communicated to the business analyst who is building the ad hoc report.

8. In the Display screen, expand the Detail Information category in the Resources box, add Order Date and LineItemTotal in it as detail fields one by one by clicking , and then modify the display name of LineItemTotal to Line Item Total. Click Next.

9. In the Group screen, select Employee Name in the Dimensions category and click to add it as a group by field, keep Ascend as the sort manner, and then click Next.
10. Skip the Summary screen and click Next, the same to the Query Filter screen.
11. In the Style screen, set the style to ClassicBlue, and then click Finish to create the report.

    The report appears as follows:

12. Click Menu > File > Rename Report.
13. In the Rename Report dialog, enter CustomerOrders as the report name, then click OK.
14. Click the Save button on the toolbar.
15. In the Save As dialog, type CustomerOrders in the Report Set Name text field, then click OK.

### Task 2: Create a table report

In this task, we will create an ad hoc report that contains a table.

1. In the current open report set window, click the New Report button on the toolbar.
2. In the New Report dialog, enter Current Customers in the Report Title text field, select Table Report in the layout box, then click OK.

   The Table Report Wizard appears.

3. In the Data screen, select BusinessCubeDemo in Data Source 1 from the Data Source drop-down list, then click Next.
4. In the Display screen, expand the Detail Information category in the Resources box, add Customer Name, Phone and CustomerCityStateZip (change its display name to Zip) as the detail fields, and then click Next.

5. In the Group screen, add Country in the Dimensions category as the group by field, keep Ascend as the sort manner, then click Next.
6. Skip the Summary screen and click Next to access the Query Filter screen.

As we would like to focus on customers not in USA, we will apply a filter to the business cube. However, we find that none of the predefined filters in the business cube can meet our requirements, so we will define another one.

1. In the Query Filter screen, select User Defined from the Query Filter drop-down list, then click the Add Condition button to add a filter line.
2. Define the filter as Country != 'USA', then click Next.

3. In the Style screen, set the style to ClassicBlue, and then click Finish to create the table report.

   The table report appears as follows:

4. Click Menu > File > Rename Report to rename the report as CurrentCustomers.
5. Click the Save button on the toolbar to save the report set.

### Task 3: Create a crosstab report

1. In the current open report set window, click the New Report button on the toolbar.
2. In the New Report dialog, type Sales Report in the Report Title text field, select Crosstab Report in the layout box, then click OK.

   The Crosstab Report Wizard appears.

3. In the Data screen, select BusinessCubeDemo in Data Source 1 from the Data Source drop-down list and then click Next.
4. In the Display screen, from the Dimensions category in the Resources box, add Employee Name as the column field and Country as the row field (keep Ascending as the sort manner for both columns and rows), then expand the Measures category and add Total Sales as the summary field. Click Next.

5. Skip the Query Filter screen. Click Next.
6. In the Style screen, set the crosstab style as ClassicBlue, then click Finish to create the crosstab report.

   The crosstab report appears as follows:

7. Click Menu > File > Rename Report to rename the report as Sales.
8. Click the Save button on the toolbar to save the report set.

### Task 4: Insert a chart

In this task, we insert a chart into the Sales report created in Task 3.

1. In the current report set window, click Menu > View > Toolbox to display he Toolbox panel.
2. Drag Chart to place it under the last row of the crosstab.

   The Chart Report Wizard appears.

3. In the Data screen, select BusinessCubeDemo in Data Source 1 from the Data Source drop-down list, then click Next.
4. In the Type screen, select the chart type as Clustered Bar 3-D, then click Next.

5. In the Display screen, add Sales Year from the Dimensions category to the Category box and Category in the same category to the Series box, then expand the Measures category and add Total Sales in it to the Show Values box. Click Next.

6. In the Query Filter screen, select NotMild from the Query Filter drop-down list as the filter and click Next.

7. In the Style screen, set the chart style to ClassicBlue, and then click Finish to create the chart.

   The chart appears as follows:

8. Click the Save button on the toolbar to save the report set.

### Lesson 1 summary

In this lesson, we created three reports in a report set based on the business cube created in Trail 3. The first report is a standard banded report, the second contains a table. In the third report, we created two components: a crosstab and a chart which show the same information.