It happens that sometimes you need to implement calculated column in ADF Faces af:table column. Value for this column is calculated based on values in other columns. There could be many approaches to achieve this, as one of the most simple I can suggest to add calculated attribute into View object, on which af:table is based.
You can download developed sample application - CalculatedValue.zip. This sample is based on standard HR schema available in Oracle XE database.
Calculated attribute can be added to View object in two steps:
1. Define new object attribute on View object, just provide name and type:
New attribute will be created as Transient:
2. Generate View Row Class for View object, just by selecting check-box in View Object Editor:
In generated class, edit getSalaryDiff() method and put needed logic here:
When described two steps are done, in Data Control calculated value becomes available and you can use it in your application User Interface layer:
Implemented sample application provides table with calculated value included - difference between maximal and minimum salaries:
When running sample application, don't forget to add adf-faces-impl.jar and jsf-impl.jar to application's WEB-INF\lib directory.