Home » ADF » ADF: Display Subtotal in ADF Table
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 :

pic1

Sample Code

About Manish Pandey

Manish Pandey is a Senior Developer with more than 3 years of experience in JAVA Programming. Currently enhancing skills in ADF.

2 comments

  1. Hi,
    Seems like there an error in this code of yours…. “#{row.FirstName==null and row.EmployeeId==null ? ‘font-weight:bold;':” it doesnt work with my Jdeveloper 11.1.2.3.0

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>