Monday, 26 November 2012

Dynamic View Object (Create View object in Controller)

           I had a requirement for getting the value from the table dynamically. That requirement was new to me. I searched in the web and found the solution, which is to create a view object dynamically. This will give you the needed data.



 String L3OnTheFlyVOQueryPFR = "select  past.USER_STATUS, "

                                                             +" FROM Per_all_assignments_f papf,"

                                                             +"PER_ASSIGNMENT_STATUS_TYPES past where ”

past.ASSIGNMENT_STATUS_TYPE_ID=papf.ASSIGNMENT_STATUS_TYPE_ID"

                                                             +" and ASSIGNMENT_ID='"+AssId+"'";



ViewObject OnTheFlyViewObjectPFR = am.findViewObject("FindPersonStaVO");

                       if(OnTheFlyViewObjectPFR == null)

                           OnTheFlyViewObjectPFR = am.createViewObjectFromQueryStmt("FindPersonStaVO ", OnTheFlyVOQueryPFR);

                          

                           OnTheFlyViewObjectPFR.executeQuery();

                           oracle.jbo.Row row = OnTheFlyViewObjectPFR.first();

                 

                  String UserStatus=null;

                 

                   if(row != null)

                   {

                      UserStatus=row.getAttribute(0).toString();

                   }

                   OnTheFlyViewObjectPFR.remove();

No comments:

Post a Comment