With the next chart, the guage chart, we will expand on the interactivity a bit and demonstrate how drill-downs work. In addition to viewing the static chart, we want the user to be able to click on the chart and have it pull up an external report with the details for a particular user. This is called a drilldown.
The following meter chart will demonstrate an employees sales vs. a target amount per month, let's say 3000, on a 5000 dollar scale. This will be broken out and grouped monthly in the query statement. When the user clicks on the chart, it will bring them to the detail report we created last chapter for Employee sales.
Employee_Sales_Guage.rptDesign
. dsClassicCars
data source. employeeSales
using the following query:select CLASSICMODELS.EMPLOYEES.EMPLOYEENUMBER, CLASSICMODELS.EMPLOYEES.LASTNAME || ', ' || CLASSICMODELS.EMPLOYEES.FIRSTNAME name, sum(CLASSICMODELS.ORDERDETAILS.PRICEEACH) sales, rtrim(char(year(CLASSICMODELS.ORDERS.ORDERDATE))) || '-' || rtrim(char(month(CLASSICMODELS.ORDERS.ORDERDATE))) orderDate from CLASSICMODELS.EMPLOYEES, CLASSICMODELS.CUSTOMERS, CLASSICMODELS.ORDERS, CLASSICMODELS.ORDERDETAILS where CLASSICMODELS.ORDERS.ORDERNUMBER = CLASSICMODELS.ORDERDETAILS.ORDERNUMBER and CLASSICMODELS.EMPLOYEES.EMPLOYEENUMBER = CLASSICMODELS.CUSTOMERS.SALESREPEMPLOYEENUMBER and CLASSICMODELS.ORDERS.CUSTOMERNUMBER = CLASSICMODELS.CUSTOMERS.CUSTOMERNUMBER and CLASSICMODELS.ORDERS.ORDERDATE between ? and ? group by year(CLASSICMODELS.ORDERS.ORDERDATE), month(CLASSICMODELS.ORDERS.ORDERDATE), CLASSICMODELS.EMPLOYEES.EMPLOYEENUMBER, CLASSICMODELS.EMPLOYEES.LASTNAME, CLASSICMODELS.EMPLOYEES.FIRSTNAME
startDate
and endDate
respectively. employeeSales
dataset to the report designer. GroupByEmployee
in the table and set it to group on the EMPLOYEENUMBER
. GroupByEmployee
and call it groupByDate
. Set it to group on the ORDERDATE
field. orderDate
details row into one large cell. Be sure to delete any data items that are still present such as the NAME
and EMPLOYEENUMBER
items. row["SALES"]
by either dragging the column over from the Data Preview pane or by using the Expression Editor. row["NAME"]
by either dragging the column over from the Data Preview section or using the Expression Editor. Employee Sales Details Report.rptDesign
. This report was created in the preceding chapter. startDate
and endDate
parameters under the Parameters drop down, which selects the parameters in the target report. Under Values, enter params["startDate"].value
and params["endDate"].value
, or whatever names that have been used used for the current report's startDate
and endDate
parameters. row["EmployeeNumber"]
. EMPLOYEENUMBER
data element. EMPLOYEENUMBER
column from the Data Explorer, next to the OrderDate
report item.Of course, this example can be heavily modified to simplify things. The charts could be consolidated into single chart, with more needles for each month instead of separate charts for each month, by moving the chart into the EmployeeNumber
group's header or footer row and adding a group by date in the chart editors dialog under the Select Data tab. It is also possible to make the needles interactive and to filter down to a specific user and date range by modifying the bookmarks in the target report, but I will leave that up to the reader to discover. The following is a modified version of the the report that has created different series in the chart itself for the date groupings.