ADF - Groovy for Total Sum of a Column in a Table - adf表格加合计
2014-06-12 13:49
946 查看
We will be looking in this article as how we can add Total of a column in a table. Very often we require to have total of a column in a table. For example , we might need total sum of Salary column in the table.
We will be leveraging power of Groovy in accomplishing this task.
So lets see how we can do this.
Use Case :- Add a Total Salary Attribute below Salary column in Employees Table.
Model Project
Considering that we have EmployeesView VO object which is based on Employees EO, go to attributes of VO and click add new attribute. Select "Add new Attribute". It will by default be transient. Give this attribute name as TotalSal.
Now go to View Accessors tab and click on green + sign to create new View Accessor.
Select EmployeesView from the first window and shuttle it so that you can see like below.
Do ok and it should be like below screenshot.
Now go to attributes tab and select the new transient attribute (TotalSal).
Give its Default value as Expression and give Groovy expression as EmployeesView1.sum("Salary") .
View Project
Create a new page. Drag and Drop EmployeesVO from data control and create a new read only table "without" TotalSal Attribute.
Now go to Salary Column in Structure and do a right click and select footer from facet as shown below.
Now from EmployeesView1 in DataControl, drag and drop TotalSal column in this new footer facet.
Now go to bindings and create a new binding for this variable.
And change the value of footer output text with this binding.
Save all and run this page.
Hope this was useful.
Happy Learning !!
We will be leveraging power of Groovy in accomplishing this task.
So lets see how we can do this.
Use Case :- Add a Total Salary Attribute below Salary column in Employees Table.
Model Project
Considering that we have EmployeesView VO object which is based on Employees EO, go to attributes of VO and click add new attribute. Select "Add new Attribute". It will by default be transient. Give this attribute name as TotalSal.
Now go to View Accessors tab and click on green + sign to create new View Accessor.
Select EmployeesView from the first window and shuttle it so that you can see like below.
Do ok and it should be like below screenshot.
Now go to attributes tab and select the new transient attribute (TotalSal).
Give its Default value as Expression and give Groovy expression as EmployeesView1.sum("Salary") .
View Project
Create a new page. Drag and Drop EmployeesVO from data control and create a new read only table "without" TotalSal Attribute.
Now go to Salary Column in Structure and do a right click and select footer from facet as shown below.
Now from EmployeesView1 in DataControl, drag and drop TotalSal column in this new footer facet.
Now go to bindings and create a new binding for this variable.
And change the value of footer output text with this binding.
Save all and run this page.
Hope this was useful.
Happy Learning !!
相关文章推荐
- Refreshing One Column based on the value of Another Column in ADFdi Table
- ADF: The best way to indicate for records in a table the existence of details
- Cannot insert explicit value for identity column in table 'settings' when IDENTITY_INSERT is set to OFF.
- ERROR OGG-01163 Bad column length (30) specified for column name in table TEST.demo_src, maximum all
- 58.The PART_CODE column in the SPARES table contains the following list of values:
- LOV for Editable Primary Key in ADF Table Problem
- Cannot insert explicit value for identity column in table 'settings' when IDENTITY_INSERT is set to OFF.
- java.lang.RuntimeException: Date pattern must be set for column update_time in the schema of component
- 82.Examine the data in the CUST_NAME column of the CUSTOMERS table.
- 3.You need to extract details of those products in the SALES table where the PROD_ID column contains
- 101.Examine the data in the PROMO_BEGIN_DATE column of the PROMOTIONS table:
- Cannot insert explicit value for identity column in table ‘table’ when IDENTITY_INSERT is set to OFF
- Display names of all constraints for a table in Or
- How Can i Store photo (image) in column of table
- 83.Examine the data in the CUST_NAME column of the CUSTOMERS table.
- add column for a table if this column not exists using T-SQL in SQLServer
- An explicit value for the identity column in table can only be specified when a column list is used and IDENTITY_INSERT is ON
- 解决MYSQL访问时无法切换数据库的问题.Reading table information for completion of table and column names
- 解决:Reading table information for completion of table and column names
- 解决:Reading table information for completion of table and column names