Sunday 6 October 2013

Calculated Attribute in ADF

This blog we will see how to create calculated attribute in Oracle ADF. Before going to create first we should understand “What is calculated attribute?”

A calculated attribute is an attribute that gets its value from the SQL statement that queries the data of the View object. Therefore, anything you can conjure up in the “SELECT” part of an SQL statement can be used to fill this attribute, from simple concatenations or decodes to PLSQL function calls and entire sub-SELECT statements. View objects can include SQL-calculated attributes.

Now we will create calculated attribute in ADF view object. Create a new attribute in view object.

Now we need to generate RowImpl class for that view object.


Now we need to modify the getter method (getAvgSalary()) of view object.

    /**
     * Gets the attribute value for the calculated attribute AvgSalary.
     * @return the AvgSalary
     */
    public Integer getAvgSalary() {
        return (getMaxSalary()+getMinSalary())/2;
    }

Now you can run your model tested and see the calculated attribute will display.

 You can download the complete application:- Download
Thanks...

No comments:

Post a Comment