Friday, August 24, 2012

Drilldown on ADF DVT graphs

The sample workspace  (JDev/ADF 11.1.2.1) for this post is available here.
Just run adfc-config from the ViewController project. 

One form of drilldown is where you provide an 'action' that can be a control flow case in the taskflow and which leads the user to another view/page, but that's not what I'm writing about. 

The drilldown i'm referring to is for the following usecase (based on the HR schema):

A graph displays Departments and total salaries of all the employees in that department. 
When you click on one of the departments (represented as a bar graph), you see the same bar graph with employees in that department. 
(You can extend this approach indefinitely but can get complex after a couple of levels of drilldown). 

My approach uses plain ADF DVT components and not BI data controls**.
It also relies on the underlying view objects to provide the aggregate data (sum of salaries in this example) and doesn't use any of the aggregation functions of the DVT components. 
You might also want to consider the approach mentioned here to see what works best for your usecase: https://forums.oracle.com/forums/thread.jspa?messageID=10527052#10527052

Master Graph:




And when you click on one of the above bars, you get to this (employees under the department you clicked.)
Also note a 'Drill Up' button or icon can be provided to go back up one level... 

As of this writing, I didn't know of a declarative approach to achieve this, so the core of this functionality is the GraphHandler class (available in the attached sample application).

**I just read about another approach that might work on this forum thread and this developer guide link but I haven't tried that and I'm not sure it would work for multiple levels of drilldown or drill-up. 

My approach relies on programmatically replacing the binding of the dvt:graph component (screenshot of the code below):



No comments: