ADF: Display Subtotal in ADF Table

ADF: Display Subtotal in ADF Table

Sometimes we need to show total of any number field like employee salary according to department but we also want to print employee name, id and other fields.

For this purpose query is-

Select first_name,employee_id,department_id,sum(salary) from employees group by first_name,employee_id,department_id

But our requirement is that we want to show total of salary according to department.
For this purpose I’m going to use SQL method named ROLLUP.

In this case I am using HR schema Employees table.

select department_id,employee_id,first_name,tsal from(
select department_id,employee_id,first_name,sum(salary)as tsal from employees
group by rollup(department_id,employee_id,first_name))
where ((employee_id is not null and first_name is not null) or (employee_id is null and first_name is null) )and department_id is not null

Step2: Now create Read only View Object using this query.

Step3: Drag-n-drop VO from Data Control as ADF read only table.

Step4: Change inline style of Department Id and Tsal filed .

inlineStyle="#{row.FirstName==null and row.EmployeeId==null ? 'font-weight:bold;':''}"

And Check The Result :


Sample Code

About Manish Pandey

Manish is a Project Leader at Jagran Prakashan Ltd, focused on Jdeveloper Fusion Web Application(specifically Oracle ADF). He shares his knowledge through the OTN Jdev/ADF Forum. He has written more than 50 article about Oracle ADF and Jdeveloper.

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.