How to Compare Dates in the OAF Controller
In this post , We will discuss about How to Compare Dates in the OAF Controller. We often need an Requirment in the OAF development to compare dates and put our custom code and logic as per the Comparisons. Here below I will share the complete which I used in my one of the requirement to Compare Dates in the OAF Controller.
How to Compare Dates in the OAF Controller
Put Code in the OAF Process Form Request
Date l_update_date;Date s_update_date;
Number ExpId;
ExpId = new Number(paramOAPageContext.getDecryptedParameter("ReportHeaderId"));
if (ExpId!=null)
{
Connection conn = paramOAPageContext.getApplicationModule(paramOAWebBean).getOADBTransaction().getJdbcConnection();
String Query = "SELECT NVL(expense_status_code,'NEW') status, LAST_UPDATE_DATE update_date,EXPENSE_LAST_STATUS_DATE status_date FROM ap_expense_report_headers_all WHERE report_header_id=TO_NUMBER(:1)";
PreparedStatement stmt = conn.prepareStatement(Query);
String RptHdrId = ""+ExpId;
stmt.setString(1,ExpId);
for(ResultSet resultset = stmt.executeQuery(); resultset.next();)
{
result = resultset.getString("status");
l_update_date = resultset.getDate("update_date");
s_update_date = resultset.getDate("status_date");
}
java.sql.Date last_update = l_update_date.dateValue();
if (s_update_date.dateValue().before(last_update))
{
---Logic/Condition --
}
0 comments:
Post a Comment