Monday Mar 05, 2012
Monday Aug 15, 2011
By Grant Ronald on Aug 15, 2011
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).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.
Tips, Tricks, Events and Information around Oracle JDeveloper, ADF, and Oracle Forms
- How to debug the HTML in Oracle MAF Applications
- UKOUG Most Read Article Award
- Video Interview of Oracle Mobile Customer
- Oracle MAF reviewed by Analyst Gigacom
- Oracle Mobile Partner Event, Europe 2015
- The world is going mobile..surprise surprise!
- ODTUG Mobile Event Reston December
- Come and learn how Northumbrian Water embraced Oracle's Mobile Framework
- How to write code in ADF - new "live" video from OW available
- Lloyds Register - a case study in the power of mobile and MAF