Hi all,
>>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
open EmpViewRowImpl class and replace code of getHiredate() method by the following code
You can download sample example from here that was developed using Jdeveloper 11.1.2.0
Thanks
Mahmoud A. El-Sayed
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 EmpViewopen 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 hireDateYou can download sample example from here that was developed using Jdeveloper 11.1.2.0
Thanks
Mahmoud A. El-Sayed
hi Elsayed.
ReplyDeleteI want to use groovy expression to set default value.
What is expression that I can use, if the default value is the other attribute value.
Ex : for attribut secAttr, I want to set its value same to firstAttr.
Thanks Elsayed
IF an attribute in the same view object you can use
Deleteadf.object.getAttributeName
If an atrribute is in another view object you can read the below post
http://mahmoudoracle.blogspot.com/2012/05/get-attribute-default-value-from.html