Sometime we need to filter ViewObject Data by Date.
For Example :-
In Employee View Object, we need to filter Employee data having HireDate equals to Current date or any date.
So we have to use below code in method of AMImpl
In above code I have used equal to (=) operator, same way we can use all Date type operator ( <,>,=,<=,>=, between).
For Example :-
In Employee View Object, we need to filter Employee data having HireDate equals to Current date or any date.
So we have to use below code in method of AMImpl
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); java.util.Date date = new java.util.Date(); String date1 = dateFormat.format(date); try { date = dateFormat.parse(date1); } catch (ParseException e) { } java.sql.Date sqlDate = new java.sql.Date(date.getTime()); oracle.jbo.domain.Date dt= (new oracle.jbo.domain.Date(sqlDate)); ViewObjectImpl vo = getemp1(); RowQualifier rq = new RowQualifier(vo); rq.setWhereClause("HireDate=to_date('" + dt +"','yyyy-MM-dd')" ); Row rw[]=vo.getFilteredRows(rq); // rw is filtered row
|
In above code I have used equal to (=) operator, same way we can use all Date type operator ( <,>,=,<=,>=, between).
No comments:
Post a Comment