Search code examples
sqloracleoraclereports

Pie Chart in Report Builder is divided in lots pieces?


My Query creates lots of entries because there are a lot of entries for dates in the view, and when I try to filter out the information in report builder it doesn't divide the pie graph into four pieces but divides it into the number of date entries in the view.

What I am supposed to do is get number parts sold for each class between dates. The dates are to be selected in report builder.

SQL Developer Query:
CREATE OR REPLACE VIEW QUERY3 AS
SELECT partclass, COUNT(p.partno) AS "Parts Sold", orderdate
  FROM part p, salesorder s, orderprod o
WHERE p.partno = o.partno
  AND o.orderno = s.orderno
GROUP BY partclass, orderdate;

Report Builder Query
SELECT * FROM QUERY3

Solution

  • You didn't post a query you use in Reports Builder. Apparently, you'll need to include a WHERE clause which restricts the result set by dates. Something like this:

    select partclass, "Parts Sold", orderdate
    from query3
    where orderdate between :par_date_from and :par_date_to;  --> this
    

    A side note: consider recreating the view and naming the "Parts Sold" column differently, such as parts_sold. The way you put it, you'll always have to reference that column using double quotes and paying attention to mixed case.

    :par_date_from and :par_date_to represent references to parameters you should create in the report. If you use the built-in Parameter Form, you'll be prompted to enter those values. Or, if you run the report differently, you'll have to pass those values to the report in order to use them.