Using following code, we can set Minimum and Maximum dates that users can select using Date filed in a OA page.
Minimum Date: Same date in Last Month
Maximum Date: Current DB Date
Modify the query to get required date values in the Date Field.
*******************************************************
OAApplicationModule am = (OAApplicationModule)pageContext.getApplicationModule(webBean);
OAMessageDateFieldBean dtBean = (OAMessageDateFieldBean)webBean.findChildRecursive("actualDate");
String dtSql= "Select add_months(sysdate,-1) min_date, sysdate max_date from dual";
try {
Connection conn = am.getOADBTransaction().getJdbcConnection();
PreparedStatement stmt = conn.prepareStatement(dtSql);
ResultSet rs = stmt.executeQuery(dtSql);
while (rs.next()) {
java.sql.Date minDate = rs.getDate("min_date");
java.sql.Date maxDate = rs.getDate("max_date");
System.out.println("Received Dates: " + minDate + " and " + maxDate);
dtBean.setMinValue(minDate);
dtBean.setMaxValue(maxDate);
} // While
} //try
catch(Exception e){
e.printStackTrace();
} //catch
******************************************************
Minimum Date: Same date in Last Month
Maximum Date: Current DB Date
Modify the query to get required date values in the Date Field.
*******************************************************
OAApplicationModule am = (OAApplicationModule)pageContext.getApplicationModule(webBean);
OAMessageDateFieldBean dtBean = (OAMessageDateFieldBean)webBean.findChildRecursive("actualDate");
String dtSql= "Select add_months(sysdate,-1) min_date, sysdate max_date from dual";
try {
Connection conn = am.getOADBTransaction().getJdbcConnection();
PreparedStatement stmt = conn.prepareStatement(dtSql);
ResultSet rs = stmt.executeQuery(dtSql);
while (rs.next()) {
java.sql.Date minDate = rs.getDate("min_date");
java.sql.Date maxDate = rs.getDate("max_date");
System.out.println("Received Dates: " + minDate + " and " + maxDate);
dtBean.setMinValue(minDate);
dtBean.setMaxValue(maxDate);
} // While
} //try
catch(Exception e){
e.printStackTrace();
} //catch
******************************************************
No comments:
Post a Comment