Domain Portal

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Monday, 14 January 2008

Complex Calculated Values in Oracle ADF af:table Component

Posted on 23:43 by Unknown
Title of this post not accidentally contains word 'complex', developed sample application is really a bit complex, but I will try to describe it in easy way. Some time ago I was blogging about how to include calculated column into af:table component - Calculated Column in ADF Faces af:table Component. But, it was just separate read-only calculated column based on values available in other columns. However, what if you need to include calculation logic for database table related column and on the same time allow it to be editable.

Developed sample application - CalculatedComplex.zip is based on HR schema available in Oracle XE database and implements logic that allows to edit two calculated columns - MinSalary and MaxSalary.

Calculation rule applied for MinSalary:
  • IF (MaxEmployeeSalary - AvgEmployeeSalary <>
Calculation rule applied for MaxSalary:
  • IF (AvgEmployeeSalary + MaxEmployeeSalary > MaxSalary) THEN update(MaxSalary)
If described conditions will not be satisfied, this means value that was entered by user will be stored in database.

MaxEmployeeSalary and AvgEmployeeSalary are values calculated in EmployeesQueryView:


Calculations for both columns are done in Backing bean, methods are invoked through dummy binding to ReadOnly property:


All calculations related to MinSalary are done in getCalculatedMinSalary() method. Based on JobId parameter are calculated AvgEmployeeSalary and MaxEmployeeSalary values, and if specified condition is satisfied MinSalary is updated:


MaxSalary is calculated in exactly the same way as MinSalary.

Now I will show how it works. Let's say we want to focus on PU_CLERK salary:


If in Employees table we set Salary values for PU_CLERK to 1900, 1600, 1700, 1600, 1500 and press Save button - MinSalary in Jobs table for PU_CLERK is updated to 240:


MaxSalary is not updated, because AvgEmployeeSalary + MaxEmployeeSalary = 3560 and this is less comparing to current 8000. So, user can set MaxSalary manually to let's say 5000 and this value will be stored in database:


When running sample application, don't forget to add adf-faces-impl.jar and jsf-impl.jar to application's WEB-INF\lib directory.
Email ThisBlogThis!Share to XShare to Facebook
Posted in ADF | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • Multiple LOV's per Attribute in JDeveloper 11g
    During OOW 2008 I have attended Steve Muench talk about new features in ADF Business Components available in 11g release - Oracle ADF: New D...
  • JBO-25058 and JBO-26001 exceptions
    In a case if you will get JBO-25058 and JBO-26001 exceptions after running application developed with Oracle ADF in JDeveloper 11g, most pro...
  • JDeveloper 11g Masterclass in Vilnius
    I'm posting update to my previous post - Oracle Forms to SOA workshop in Vilnius , where I was describing masterclass session I will do ...
  • Opening Report Window in ADF Faces
    Such requirement as opening report window can be assumed as easy one. But, when I have received request for solution, it was not so easy to ...
  • Oracle JDeveloper/ADF Real Life Story on Oracle OpenWorld
    Yes, that right - I was presenting Oracle JDeveloper/ADF Real Life Story on Oracle OpenWorld in Unconference section. Everyone was free to c...
  • JDev/ADF samples list
    This week, Steve Muench on his examples page have added a link to my JDev/ADF samples list . Thanks, I'm very proud of this - it is co...
  • Oracle Always Rocks !
    This song was performed at Oracle OpenWorld 2007, after Larry Ellison and Safra Catz keynote - Sunday Night Live—30 Years Behind The Scenes ...
  • Oracle Fusion Middleware 11g Technology Preview 3 - whats included?
    Probably almost everyone have noticed Christmas gift from Oracle - JDeveloper 11g Technology Preview 3 . What new things are inside this gif...
  • List-Of-Values Component in Search and Edit Form
    Sample application described in this post contains high practical value, it implements real use case. Defined use case - based on value sele...
  • Oracle Magazine Peer-to-Peer column
    My profile is published in Oracle Magazine January/February 2008 edition - Favorite Things . Profiles of Oracle ACE Director - Chris Ostrow...

Categories

  • ADF
  • Apex
  • Apple
  • BPEL
  • Events
  • Forms
  • Groovy
  • JDeveloper 11g
  • Nomination
  • ODTUG Kaleidoscope
  • OFUG
  • Oracle Magazine
  • Oracle OpenWorld
  • Security
  • SOA
  • Spatial
  • TopLink
  • Traveling
  • Uncategorized
  • Vgo Software
  • Web Services
  • WebCenter
  • WebLogic
  • Workarounds

Blog Archive

  • ▼  2008 (72)
    • ►  December (2)
    • ►  November (3)
    • ►  October (9)
    • ►  September (4)
    • ►  August (9)
    • ►  July (6)
    • ►  June (10)
    • ►  May (4)
    • ►  April (5)
    • ►  March (7)
    • ►  February (5)
    • ▼  January (8)
      • Athens - Warm and Friendly City
      • Using af:popup Component in JDeveloper 11g
      • Trip to US
      • Oracle to acquire BEA
      • ODTUG Kaleidoscope '08 - Abstract Accepted
      • Complex Calculated Values in Oracle ADF af:table C...
      • Hints for List-Of-Values (LOV) in JDeveloper 11g TP3
      • Complex List-Of-Values (LOV) in Oracle ADF
  • ►  2007 (65)
    • ►  December (6)
    • ►  November (7)
    • ►  October (6)
    • ►  September (4)
    • ►  August (3)
    • ►  July (4)
    • ►  June (6)
    • ►  May (5)
    • ►  April (6)
    • ►  March (4)
    • ►  February (5)
    • ►  January (9)
  • ►  2006 (9)
    • ►  December (9)
Powered by Blogger.

About Me

Unknown
View my complete profile