What is great about ADF BC - this framework is very close to the DB and makes data management and analysis operations implementation really easy. There are different ways to implement total and average value calculation. The best way probably is to use Oracle DB Analytic Functions. Using analytic functions minimizes custom Java code, simplifies handling search from Query criteria of from table filter. There is no need to specify GROUP BY in SQL when using analytic functions, this makes easier ADF BC VO implementation.
You are welcome to download sample ADF 11g R2 application - ADFAnalyticFuncApp.zip. Two calculated attributes are added to the Employees VO, both of them are initialized from SQL statement calling analytic function. Here is example for total calculation - check SQL statement for calculated attribute:
Here is for the average:
This is how resulting SQL statement looks for ADF VO with two calculated attributes based on analytic function:
This is all about ADF BC. On ADF UI you need to define in page definition two attributes for calculated fields:
Reference these attributes from table column footer for example:
It works smooth on runtime - search is executed from ADF query, total and average reflect salary data:
If you want, type search criteria into table filter and execute additional filtering - total and average values will be automatically recalculated based on filtered table data:
You are welcome to download sample ADF 11g R2 application - ADFAnalyticFuncApp.zip. Two calculated attributes are added to the Employees VO, both of them are initialized from SQL statement calling analytic function. Here is example for total calculation - check SQL statement for calculated attribute:
Here is for the average:
This is how resulting SQL statement looks for ADF VO with two calculated attributes based on analytic function:
This is all about ADF BC. On ADF UI you need to define in page definition two attributes for calculated fields:
Reference these attributes from table column footer for example:
It works smooth on runtime - search is executed from ADF query, total and average reflect salary data:
If you want, type search criteria into table filter and execute additional filtering - total and average values will be automatically recalculated based on filtered table data: