Default Value for View Object Rows Attributes

Hi all,
Introduction
As usual in all programming tools we need to set default values for columns.
>>In oracle database we can do that by DDL
ALTER TABLE Table_name MODIFY(column_name  DEFAULT default_value);
>>In oracle forms tool we can do that by setting initial value of item in block.

So I will present how to set deafult value of attribute in VO at ADF.
We can do that by 3 ways
1-Using a Groovy expression
2-Getter of attribute
3-Override view object create() method

1-Using a Groovy expression
You should follow the following steps
open the view object that you want for example EmpView.
select attribute that you want to set its default value for example setting current date to HireDate column
set expression for deafult value and enter adf.currentDate in expression


2-Getter of attribute
We must generate view object class, View row class for EmpView



open EmpViewRowImpl class and replace code of getHiredate() method by the following code



3-Override view object create() method
we will overide create() method in EmpViewRowImpl class and setting deafult value of hireDate



You can download sample example from here that was developed using Jdeveloper 11.1.2.0

Thanks
Mahmoud A. El-Sayed

Popular posts from this blog

ADF : Get Current Logged User Name

OAF : Get Current Row in Table

ADF : Working with ViewCriteria