Hello
In this post i'll show you how we can add total of a column in table using Groovy
To show total we need
1- create transient attribute in employees view object and set Type BigDecimal
2-write the following groovy in expression
object.getRowSet().sum('Salary')
3-create a .jsf page and drag and drop employees view object on .jsf page as table
To show footer you need to do the following steps
from structure window right click on salary column go to Facets-Column and select Footer from small window
4-create attribute value
to create attribute value we need to go page bindings
click on green plus button
from insert Item window select AttributeValues and click ok
5-create attribute binding
when we click on OK a new window will appear name as create attribute Binding
select data source and attribute according to following image and click ok
6- finally we need to assign footer value
go back to page Design tab
from component palette drag and drop output text on footer
select output text and write expression according to image
To show total we need
1- create transient attribute in employees view object and set Type BigDecimal
2-write the following groovy in expression
object.getRowSet().sum('Salary')
3-create a .jsf page and drag and drop employees view object on .jsf page as table
To show footer you need to do the following steps
from structure window right click on salary column go to Facets-Column and select Footer from small window
4-create attribute value
to create attribute value we need to go page bindings
click on green plus button
from insert Item window select AttributeValues and click ok
5-create attribute binding
when we click on OK a new window will appear name as create attribute Binding
select data source and attribute according to following image and click ok
6- finally we need to assign footer value
go back to page Design tab
from component palette drag and drop output text on footer
select output text and write expression according to image
No comments:
Post a Comment