Saturday, November 10, 2012

Oracle OAF:Date Field -set min and max date

Hi All,


Its long time i have written anything interesting..too much occupied in job and not able find time to write anything...

Now a days i am working some interesting projects.. projects just to enhance user experience in using oracle projects.

Instead of multiple clicks in OOB we are developing a single screen to perform the same transaction...
and one screen to view all the data he need.
 we are working developing Custom OAF page and integrating with Oracle OOB.

OOB-- Out of box(oracle standard pages)

One of the requirements was to control the calendar in the date field..our requirement was to stop user from selecting any date in the past.
















There are multiple approaches for doing this either in complete java or JAVA and PLSQl
here i am presenting one of the approaches of getting date from DB
--Get page connection

Connection conn = pageContext.getApplicationModule(webBean).getOADBTransaction().getJdbcConnection();

--sql query

String selectSQL = "select NVL(TO_DATE (fnd_profile.VALUE ('XX_GLOBAL_DATE'),'DD-MON-RRRR'),SYSDATE) date1 FROM DUAL";

System.out.println("SQL: "+selectSQL);

--parse the sql

PreparedStatement stmt = conn.prepareStatement(selectSQL);

--execute query

ResultSet rs = stmt.executeQuery(selectSQL );

System.out.println("RS: "+rs);

while (rs.next())
{
java.sql.Date date = rs.getDate("date1");
--get the date field handler
OAMessageDateFieldBean dateField = (OAMessageDateFieldBean)webBean.findIndexedChildRecursive(stat_date);
--set the minimun value
dateField.setMinValue(date);
}
similary we can set the max date also ...But make sure the date is in sql date type.

But one catch is  if user dont use the calendar and type date in the field the system will allow a past date.To over come this issue
you need to have a validation logic defined either in the set attribute of the VO or a error raised from DB if you are not comfortable in java :)

8 comments:

Unknown said...
This comment has been removed by the author.
Mohammed Azhar said...

TekSlate is the reputed e-learning tutorial across the globe delivers brief understanding about oaf in oracle oaf free tutorial with advanced teaching methodologies

To Learn More Follow Below Link:
http://bit.ly/1yJXoH8

jacab said...

Oracle OAF Online Training
Hyderabadsys Online Training providing excellent Oracle OAF Online Training Classes by real time Professionals. we also provide corporate training for multiple countries like USA, UK, Singapore, Japan, Europe and Other Countries.
Our training methodology is very unique.Our Oracle OAF Classes covers all the continuous situations, and its totally on Hands-on for every single session. Hyderabadsys provide Oracle OAF online classes according to the students requirements and students pick normal track or fast track.
we also provide interview so that you will be able to clear your interview in very less attempts.Hyderabadsys also offering technical support with our experts. We give Oracle OAF training with realtimesenarious so that you will be able to work on any project after the training

Unknown said...

Its impressive to know something about your note on Oracle apps Course. Please do share your articles like this your articles for our awareness. Mostly we do also provide Online Training on Cub training oracle apps course.

jacab said...

Hyderabadsys Online Training is the best online training provider for learners throughout the world. We provide online training in Oracle OAF Technology. Our trainers are very well experienced and real time faculty having Excellent knowledge in real time environment.
Hyderabadsys maintain quality in Oracle OAF training. Our trainers are always available to get to you for doubt clarification during course. They can help you with real time scenarios and provides you for regular practice which will help you in getting commanding power on Oracle OAF.
Hyderabadsys provide online training for all IT related courses like Oracle, SAP ABAP, SAP CRM, SAP FICO including all SAP modules and Core Java, Adv Java, Hadoop technologies as well.

Unknown said...

Smartmind Online Training provides complete knowledge regarding all core concepts and it gives enough confidence about Oracle OAF . We can say Smartmind Online Training  is the best Oracle OAF  Training platform for freshers because here we start every concept from the ground level and we explain concepts by taking real time scenarios, so Students get good understanding about subject. Smartmind Online Training  helps you to gain depth knowledge on Oracle OAF  and it makes you ready to become a real time Software Developers
SAP OAF Online Training

Unknown said...

Thank you very much for sharing this Valuable information..Oracle OAF Online Training

Unknown said...
This comment has been removed by the author.