Jump to content
Changes to the Jaspersoft community edition download ×

Can JFreeChart in Jasper iReports use JDBCCategoryDataSet?


lucky7456969

Recommended Posts

I have seen a video in which it uses JRBeanCollectionDataSource, but can I use JDBCCategoryDataSet instead?

Where can I set this up?

I actually pass in a query like

"select p.ProductID, p.ProductName from products AS p"

Then I have a subreport which in turn

SELECT products.ProductID,
          products.ProductName,
          SUM(IF(cust.Age < 20,1,0)) as 'Under 20',
          SUM(IF(cust.Age BETWEEN 20 and 29,1,0)) as '20 - 29',
          SUM(IF(cust.Age BETWEEN 30 and 39,1,0)) as '30 - 39',
          SUM(IF(cust.Age BETWEEN 40 and 49,1,0)) as '40 - 49',
          SUM(IF(cust.Age BETWEEN 50 and 59,1,0)) as '50 - 59',
          SUM(IF(cust.Age BETWEEN 60 and 69,1,0)) as '60 - 69',
          SUM(IF(cust.Age BETWEEN 70 and 79,1,0)) as '70 - 79',
          SUM(IF(cust.Age BETWEEN 80 and 89,1,0)) as '80 - 89',
          SUM(IF(cust.Age >= 90,1,0)) as 'Above 90',
          count(cust.CustomerID) AS 'NoOfCustomer'
          FROM (((products AS products
          LEFT JOIN order_details AS order_details ON (order_details.ProductID = products.ProductID ))
          LEFT JOIN orders AS orders ON (order_details.OrderID = orders.OrderID ))
          LEFT JOIN customers AS cust ON (orders.CustomerID = cust.CustomerID ))
          where products.ProductID = $P{ProductID}
          GROUP BY products.ProductName

I pass in the subreport with the parameter of the productid

 

Can I reuse this query data in my JFreeChart right below it

http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/data/ListOfArrayDataSource.html

Note that how can I go up one level to the parent report and dig down to the subreport of age group distribution listed above

Update:

II understand I could have used the java beans datasource, but how can I create the beans inside Jasper report,

rather than inside the Java code?

 

 

With Thanks

Jack

 

 

 

 

 

 

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...