加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

ADF - Groovy for Total Sum of a Column in a Table - adf表格

发布时间:2020-12-14 16:50:15 所属栏目:大数据 来源:网络整理
导读: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 o
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 !!

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读