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

Using Groovy to read values from a different view object

发布时间:2020-12-14 17:02:49 所属栏目:大数据 来源:网络整理
导读:原文: http://blogs.oracle.com/grantronald/entry/using_groovy_to_read_values We recently posted an ADF Insider Essentials that showed how to build an LOV switcher.? In this example,Frank Nimphius wrote a custom method into the PaymentTypeV

原文: http://blogs.oracle.com/grantronald/entry/using_groovy_to_read_values

We recently posted an ADF Insider Essentials that showed how to build an LOV switcher.? In this example,Frank Nimphius wrote a custom method into the PaymentTypeVOImpl which returns the string CASH or CREDIT depending on the lookup value passed in (1 or 2).? This method is then called from the Orders view object via a Groovy expression.

However,there is an even quicker way without even having to create a custom method.? To explain,I'm going to use the good old Employees and Jobs tables from the HR schema.? Lets assume,that when you create a new employee their default role is AC_MGR (account manager) and their default salary should be the minimun salary for an accout manager.? In this case,we'll actually read the minimum salary into the EmployeesVO.Salary field from the JobsVO.Min_Salary field.

1) First create default ADF BC based on Employees and Jobs

2) In the EmployeesVO add a view accessor to JobsVO (and call it JobsView).? This "links up" the EmployeesVO to the JobsVO

3) Set the default EmployeesVO.JobId to AC_MGR

4) Set the default EmployeesVO.Salary to JobsView.findByKey(key(JobId),1)[0].MinSalary

So what does this Groovy expression do?? It "walks" to the JobsVO using the JobsView accessor and then calls findByKey using the JobId.? This returns an array and since we know JobId is unique we can just get the first entry's MinSalary.

(编辑:李大同)

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

    推荐文章
      热点阅读