Apply View criteria at runtime to child View object

Hi,
I am facing issues while trying to assign View Criteria to child VO that is part of View hierarchy at runtime.
AM Model:
Parent VO ->
Child VO1
-> Child VO2
View Link between :
Parent VO -> Child VO1
Child VO1 -> Child VO2
I have to apply View criteria at runtime at Child VO1 & Child VO2, i tried setApplyViewCriteriaName from AMImpl for these VO but that doesnt work.
It works for Parent VO, So I concluded Apply VC doesnt work directly for Tree structure.
I then override executeQueryforCollection in the VO however i am never able to get the handle for the VO that is getting executed :
Here's what is happening when i fetch my VO tree from AM :
- Parent VO , Child VO are getting instantiated
- Parent VO executeQueryforCollection called
- ** After this a new instance of Child VO is getting instantiated and i dont have any control of setting the VC based on some custom property
as all get defaulted at this point.
Please suggest what can be done in this case.
PS : i can not hardcode the VC condition at View Link.
- Sam

I was able to set the VC condotinally based on property set at Parent level using following code in executeQueryForCollection :
ApplicationModule am= this.getApplicationModule();
ViewObject vo = am2.findViewObject("ParentView1");
prop = (String)vo.getProperty("Parent_prop");
if(propVo_prop.equals("Y"))
this.setApplyViewCriteriaName("VC");
super.executeQueryForCollection(object, object2, i);
is this the right way ? Any performance bottleneck ? This service can be called for 1000 Id's .
Please suggest if there is some better way.
Thanks
-Sam

Similar Messages

  • ADF View Criteria on a Read Only View Object

    Hi,
    I have created a read only view object using a query. The query consists of analytical functions to fetch the AVG values dynamically.
    So far my approach worked fine.
    I want the Average values in my query to be calculated dynamically based on the certain view criteria.
    But after applying view criteria, my query is formulated as shown below:
    SELECT * FROM (SELECT   RECEIVED_YEAR,
               WEEK_NO,
               NO_RECEIVED,
               NO_STARTED,
               ROUND (TO_NUMBER (REPLACE (AVG_HRS_TO_START, ':', '.')),2) AVG_HRS_TO_START,
               ROUND (AVG (TO_NUMBER (REPLACE (AVG_HRS_TO_START, ':', '.'))) OVER (ORDER BY RECEIVED_YEAR),2)              OVERALL_AVG_HRS,
               GOAL_HRS,
               ROUND (AVG (NO_STARTED) OVER (ORDER BY RECEIVED_YEAR), 2) AVG_NO_STARTED,
               ROUND (AVG (NO_RECEIVED) OVER (ORDER BY RECEIVED_YEAR), 2) AVG_NO_RECEIVED
               FROM ORDERS_RCPT_TO_START_VW
    ORDER BY RECEIVED_YEAR, WEEK_NO) QRSLT  WHERE ( ( ( ( (RECEIVED_YEAR = :RecdYear ) AND (WEEK_NO <= :weekNo ) ) ) ) )
    As per this query, it is calculating the Average values first and then applying filter criteria rather than applying the filter criteria and calculating average values.
    Please help me on this.

    Entity objects are used to update/delete/insert data to the database.
    If all your base DB object offers is read then just create a read only view object.

  • Named View Criteria with no wizard - I write the SQL

    Using JDeveloper/ADF 11.1.2.3.
    Is there a way to create a named View Criteria with a SQL Select that is more complex than the wizard can write?
    I know that I can write code to create a View Criteria at runtime, but then I can't just drag and drop it like a named one.
    One use case:
    I have a table named FACILITIES, with a detail table named FACILITY_SERVICES. I want a view criteria for FACILITIES that finds all facilities that have all the required services in a bind variable that is a comma delimited list.
    WHERE list.to_vc_array(:requiredServices) /* I wrote this function to translate a comma delimited list to my own vc_arraytype. */
       SUBMULTISET OF
          CAST(MULTISET ( SELECT service
                            FROM facility_services
                           WHERE facilities.facility_id = facility_services.facility_id)
               AS vc_arraytype)With the wizard, I can't even write a simple IN query (match at least one of the required services), much less this more complex one (match ALL the required services).

    I'm not sure that this is so bad :)
    You need to implement one interface and override one method.
    For example:
    public class YourVOImpl extends ViewObjectImpl implements ViewCriteriaAdapter {
        protected void create() {
            super.create();
            setViewCriteriaAdapter(this);
        @Override
        public String getViewCriteriaClause(ViewObject viewObject, ViewCriteria viewCriteria) {
            if (viewCriteria == null || viewCriteria.size() == 0) return null;
            return "list.to_vc_array(:requiredServices)\n" +
                      "   SUBMULTISET OF \n" +
                      "      CAST(MULTISET ( SELECT service\n" +
                      "                        FROM facility_services\n" +
                      "                       WHERE facilities.facility_id = facility_services.facility_id)\n" +
                      "           AS vc_arraytype)");
    }Dario

  • View Criteria

    Hi,
    I am new to adf exploring by doing one POC ,my requirement is, i need to call the application module impl through backing bean to search based on 2 inputs form DB table and the result set i need to store into session.
    for this i wrote view criteria and how to call
    I need to get through backing bean
    this i wrote in VOImpl class under one method which i am calling from Application module impl class
    Proj_name and PA_name are bind variables of View criteria in VOimpl class(Generated View Object class)
    ViewCriteria vc =getViewCriteria("ProjectViewObjVOCriteria");
    setPA_name(ProjName);
    setProj_name(PANumber);
    applyViewCriteria(vc);
    executeQuery();
    error :oracle.jbo.InvalidObjAccessException: JBO-25036: An invalid object operation was invoked on type View Object with name ProjectViewObjVOImpl_19 at first line( setPA_name(ProjName);) setting in above stmts
    is it correct what i m doing? if not can anyone guide me in this
    Thanks in advance
    Praveen
    Edited by: user13584306 on Feb 6, 2012 3:20 AM

    hi,
    just go through the links
    http://udayarocks.wordpress.com/2011/06/08/how-to-reuse-a-view-object-vo-for-different-search-criteria-in-multiple-pages-in-adf/
    Set the view criteria bind variable from backing bean
    http://adfpractice-fedor.blogspot.in/2011/08/how-to-apply-view-criteria.html
    regards,
    Ranjith

  • Including additional where clause conditions to view criteria dynamically

    Hi,
    We have a set of view objects that serves as LOV for various other view objects. All such LOV view objects have three specific attributes, two date attributes namely EffectiveStartDate, EffectiveEndDate and a String attribute namely UserSwitch based on which the LOV list needs to be filtered.
    All the view objects are having one or more view criterias with specific where clause conditions.
    Apart from those view criteria conditions, invariantly, we need the following conditions also
    :bindEffDate between EffectiveStartDate and EffectiveEndDate and UserSwitch = :bindUserSwitch.
    We wish not to include the above condition in each and every view criteria of each and every view object (Since we have around 800 view objects and a minimum of 2 view criterias per view object). Instead, we created a dummy view object (BaseViewObject) with two bind variables :bindEffDate and :bindUserSwitch and all the LOV view objects were made to extend this BaseViewObject.
    Therefore, whenever a view object atribute is attached with LOV using the above said LOV View Objects, the bind variables of the baseViewObject as well as the view object specific bind variables are available in the view accessors tab of the view object wizard where we can supply values to those bind variables.
    Now, we need to construct the view criteria filter clause. To achieve this, we created a class, CustomCriteriaAdapter.java extending oracle.jbo.server.CriteriaAdapterImpl. In the getCriteriaClause() method, we included the follwoing code:
    public String getCriteriaClause(ViewCriteria pViewCriteria)
    ViewObject vo = pViewCriteria.getViewObject();
    String userSelectSwitch = (String) vo.ensureVariableManager().getVariableValue("bindUserSwitch");
    String effBgnDt = vo.getAttributeDef(vo.getAttributeIndexOf("EffectiveStartDate")).getName();
    String effEndDt = vo.getAttributeDef(vo.getAttributeIndexOf("EffectiveEndDate")).getName();
    String customCriteria = " ( :bindEffDate >= " + effBgnDt + " ) AND ( :bindEffDate <= " + effEndDt + " OR " + effEndDt + " IS NULL ) ";
    StringBuffer completeCriteria = new StringBuffer();
    String criteriaClause = super.getCriteriaClause(pViewCriteria);
    if (criteriaClause != null && !criteriaClause.isEmpty())
    completeCriteria.append(criteriaClause + " AND ");
    completeCriteria.append(customCriteria);
    if (userSelectSwitch != null && "Y".equals(userSelectSwitch))
    String userSelectSw = vo.getAttributeDef(vo.getAttributeIndexOf("UserSwitch")).getName();
    completeCriteria.append(" AND (" + userSelectSw + "='Y' ) ");
    return completeCriteria.toString();
    Issues:
    The LOV list is not filtering the records based on the constructed conditions. Instead it is listing either all of the records considering only the view criteria conditions applied at design time irrespective of the userswitch and effectivedate conditions or the list is empty.
    Here, my questions are,
    1. Am I in the correct approach? If not, guide me in a more proper approach to achieve the same requirement.
    2. If the way I am trying is correct, where things are going wrong and why the dynamic condition is not getting effected?
    Kindly help in sorting out the issue.
    Thanks in advance.

    Hi Jobinesh,
    Thanks for your response and yes, we have done exactly as what you have mentioned. As explained earlier, a baseViewObject along with its Impl class has been created and it will be extended by all the viewobjects meant for serving LOV. Therefore, the superClass for any such LOV viewObject is the baseViewObjectImpl class. In that baseViewObjectImpl(), we have over-rided the criteriaAdapter() method and returned an instance of our customCriteriaAdapter() class.
    Below is the code we are using in the baseViewObjectImpl():
    package model.base.vo;
    import oracle.jbo.CriteriaAdapter;
    import oracle.jbo.server.ViewObjectImpl;
    public class BaseViewObjectImpl
    extends ViewObjectImpl
    * This is the default constructor (do not remove).
    public BaseViewObjectImpl()
    * Over-rided method of ViewObjectImpl class of the framework.
    * Calls the customized criteria adapter so that the default where clauses are added to the view criteria.
    * @return CriteriaAdapter.
    @Override
    public CriteriaAdapter getCriteriaAdapter()
    return new CustomCriteriaAdapter();
    I'll create a sample in HR schema and share with you shortly.
    Thanks and regards.

  • ADF-View criteria

    Hi all:
    I'm working in Jdev TP3.
    I do view criteria on the view and then I want to do search form with it.
    The view has a transient column to checkbox but I don't know how insert on the view criteria because if I insert it
    doesn't appear on the search form.
    Can somebody help me?
    Thanks in advance.

    Thanks by reply Steve
    The transient attibute is boolean. I did because I have string attribute and I need to show checkbox.
    I add transient attribute to the view criteria and Query Execution Mode put "in memory " because it didn't leave put database.
    When I dropped a view criteria, I used my custom view criteria which included the transient attribute.
    Thanks in advance.

  • How to apply common View criteria for all LOV View programatically?

    Hi,
    In my application I use nearly 100 VOs, which will be mapped as LOV to some base VOs. These VOs are not only for LOV but also will be used directly in screen as read-only table. All these VOs contains EFF_BGN_DTand EFF_END_DT. Requirement is to display only the active records in VO.
    We don't want to crete view criteria at design time for each and every VO. Instead we want to have a base ViewObjectImpl class, create at runtime and add this common criteria with the existing view criterias (If any given, which are actually required for the developer for screen specific functionality).
    NOTE: As all of our VOs are custom java data source implemented and none of them have queries, we cannot use whereclause API but only ViewCriteria.
    We want to create a view criteria, that somewhat looks like the below condition.
               (     (TO_CHAR( EffBgnDt, 'yyyy-mm-dd') <= '2010-02-01' )
                 AND (TO_CHAR( EffEndDt, 'yyyy-mm-dd') >= '2010-02-01' )
                 OR
               (     (TO_CHAR( EffBgnDt, 'yyyy-mm-dd') <= '2010-02-01' )
                 AND (EffEndDt IS NULL )
               )Question:
    1. Which is the best place in ViewObject class, where I will be able to create common view criteria, include it with existing criterias.
    Thanks in Advance.
    Raghu

    No it is not working. I've tested. When i test your implementation in my sample using AM tester, it is not at all going inside getCriteriaItemClause(ViewCriteriaItem pViewCriteriaItem). For example when i say, AM.findViewObject(String ViewObjectName), followed by getEstimatedRowCount(), it should apply common filter criteria and give me the result.
    Given below required scenario:
    Department table:
    ID     DEPT_NAME     START_DATE     END_DATE
    1     Hr          1-Jan-2010     
    2     Purchasing     1-Jan-2010     31-Dec-2010
    3     Shipping             1-Jan-2010     31-Dec-2055
    4     Sales          1-Jan-2010     
    Common criteria to be applied (Programatically) : :bind_current_date between StartDate and EndDate or :bind_current_date >= StartDate and EndDate is null
    VO specific view criteria (may vary VO to VO): DeptName not equal to 'Sales'
    Expected Result:
    Case 1:
             a. DeptView = AM.findViewObject("DepartmentVO")
             b. DeptView.getEstimatedRowCount()
              It should give me 3 records (Hr, Shipping, Sales)
    Case 2:
             a. DeptView = AM.findViewObject("DepartmentVO")
             b. Create View Criteria 'NotSalesDeptVC', which should not list out Sales department.
             c. Apply NotSalesDeptVC using RowSet rowSet = (RowSet) this.findByViewCriteria(NotSalesDeptVC, -1, ViewObject.QUERY_MODE_SCAN_VIEW_ROWS)
             d. rowSet.getEstimatedRowCount()
              It is in-memory filtering, will not disturb the default rowset, should give me 2 records (Hr, Shipping)
    Case 3:
             a. DeptView = AM.findViewObject("DepartmentVO")
             b. Apply 'NotSalesDeptVC' to the default row set, followed by executeQuery
             c. DeptView.getEstimatedRowCount()
              It should give me 2 records. (Hr, Shipping)
    Case 4:
             a. DeptView = AM.findViewObject("DepartmentVO")
             b. Unapply the applied 'NotSalesDeptVC', followed by executeQuery
             c. DeptView.getEstimatedRowcount()
              It should give me 3 records (Hr, Shipping, Sales)Essence is at any point of time, User should always work with active records. He no need to write extra logic to retrieve only the active records but the base Viewobject impl should have. Note, All of my view objects are custom java data source implemented and not query based. Similarly it does not meant that all of my VOs will be having some business specific View criteria. Some VOs may have. Some VOs may not have. However basic active records criteria is applicable for all VOs

  • Is it even possible to dynamically apply view criteria in an ADF Web App?

    This is one of those situations where something that should take an hour ends up taking days.
    * I have a view.
    * The view has Bind Variables associated with it.
    * The view has View Criteria associated with it.
    * Each of the View Criteria use different Bind Variables.
    * I have a search criteria input page that receives from the user what will ultimately be used to set the bind variables.
    * I have a search results page that uses the view to display a table.
    * I have the code that dynamically sets view criteria and parameters. It is based on the following:
    http://download.oracle.com/docs/cd/E15523_01/web.1111/b31974/bcadvvo.htm#BCGFHAGA
    * This code works great, until the iterator associated with the table binding to the view is initialized. At that time, the view is reset to its defaults, and all of my code's doings are discarded. How do I know this? Because I have gone so far as to run my code that sets view criteria and binding variables dynamically in a phase event handler for the search results page in the render response phase. There is no other point at which to dynamically modify the view.
    This is turning into a situation where it seems I will need 5 different views and 5 different pages in order to show a single set of query results. I cannot get dynamically applied view criteria to work in an ADF web app. Has anyone else done it? Can anyone relate to this? Are there any other suggestions before I conclude that it's not possible for this framework to handle this simple scenario?
    Thanks

    There must be a setting or something that I am still missing here. If I write code just like this and make sure it is executed, I still only see the results of my view executed without the view criteria applied using the default bind variable values that I supplied in the view object.
    It's like the fact that I set the bind variables, the view criteria, and executed the view query programmatically is lost on the iterator -- it's like it never happened. What setting is used to ensure that the iterator uses the outcome of what I executed programmatically? There has to be a critical set or setting that I am missing.
    Here is the iterator and search region definitions defined in the page def "executables" section:
      <executables>
         <iterator Binds="CustomSearchView1" RangeSize="25"
                  DataControl="AppModuleDataControl"
                  id="CustomSearchView1Iterator"/>
        <searchRegion Binds="CustomSearchView1Iterator"
                      Customizer="oracle.jbo.uicli.binding.JUSearchBindingCustomizer"
                      id="CustomSearchView1Query"/>
        </executables>Here's the "tree" binding in the page def file:
      <bindings>
       <tree IterBinding="CustomSearchView1Iterator" id="CustomSearchView1">
          <nodeDefinition DefName="Model.CustomSearchView" Name="CustomSearchView10">
            <AttrNames>
              <Item Value="CustomId"/>
              <Item Value="CustomProjectNumber"/>
              <Item Value="CustomName"/>
              <Item Value="CustomStatus"/>
              <Item Value="CustomStatusDate"/>
            </AttrNames>
          </nodeDefinition>
        </tree>
      </bindings>In an effort to take page flow out of this mess, I had modified this to include the search criteria and search results on a single page. So, I now have a "Search" button. When the "Search" button is clicked, the action method does the following:
        public String searchActionListener ()
              // Get search criteria from select one choice and text input controls.
              AppModule appModule =
                    ( AppModule ) Configuration.createRootApplicationModule (
                        "Model.AppModule",
                        "AppModuleLocal");
              appModule.customSearch( searchCriteria1,
                                                   searchCriteria2,
                                                   searchCriteria3 );
        }In my application module this translates to:
        public void customNoticeSearch ( String searchCriteria1, String searchCriteria2, String searchCriteria3)
           CustomSearchViewImpl searchViewImp =
               ( CustomSearchViewImpl ) this.getCustomSearchView1 ();
           searchViewImp.customExecuteQuery ( searchCriteria1, searchCriteria2, searchCriteria3);
        }Finally, in my custom view object implementation code:
        public void customExecuteQuery ( String searchCriteria1, String searchCriteria2, String searchCriteria3 )
            // Set-up the parameters that are part of the core query.
            this.setp_searchCriteria1( searchCriteria1);
            this.setp_searchCriteria2( searchCriteria2);
            if ( searchCriteria3 != null )
                ViewCriteriaManager vcm = this.getViewCriteriaManager();
                ViewCriteria vc = vcm.getViewCriteria ( "WithLastCriteria" );
                this.setp_searchCriteria3( new Number ( searchCriteria3 ) );
                this.applyViewCriteria( vc );
            System.out.println ("This is fun.");
            this.executeQuery();
        }This code executes, but the results table is empty, and I know that there are results, because I can execute use execute with params to execute the base query and get the correct results back.
    Thanks for taking a look at this.

  • Applying distinct to a query search panel view criteria

    I have a VO that returns multiple instances of the same project code...In the ADF query panel I only need to display a distinct set of these project codes...
    When building a simple ADF query panel based on a view criteria declaratively the project codes will repeat themselves in the select one choice component of the query panel.
    What is the best way to apply a distinct to a view criteria of this sort?
    Thanks in advance.

    Hi
    Edit query- Select Sql Mode to "Expert" and manually change the query.
    M Niaz

  • Applying view criteria dynamically

    Hi,
    its urgent...... please guide me....
    in my application I want to execute the viewobject once using database than it should store in cache memory and after applying view criteria it should filter the data and give from the memory after clearing it it should return all the records from the cache memory no need to go database...
    I have used the following code......
    public void getViewdata()
                   ApplicationModule am = Configuration.createRootApplicationModule("model.HRAppModule", "HRAppModuleLocal");
            ViewObject viewobject = am.findViewObject("employeesVo1");
            viewobject.executeQuery();
                  System.out.println("no of records:\t" + viewobject.getRowCount());
            System.out.println("no of records:\t " + viewobject.getFetchedRowCount());
            System.out.println("no of records:\t" + viewobject.getEstimatedRowCount());
            System.out.println("Query Mode of viewobject:\t" + viewobject.getQueryMode());
            ViewCriteria Viewcriteria = null;
            Viewcriteria = viewobject.createViewCriteria();
            Viewcriteria.setCriteriaMode(Viewcriteria.CRITERIA_MODE_QUERY | Viewcriteria.CRITERIA_MODE_CACHE);
            System.out.println("Viewcriteria mode is:\t" + Viewcriteria.getCriteriaMode());
            viewobject.setQueryMode(viewobject.QUERY_MODE_SCAN_VIEW_ROWS);
            System.out.println("Query Mode of viewobject:\t" + viewobject.getQueryMode());
            Viewcriteria.setConjunction(Viewcriteria.VC_CONJ_AND);
            ViewCriteriaRow Viewcriteriarow = Viewcriteria.createViewCriteriaRow();
            ViewCriteriaRow Viewcriteriarow1 = Viewcriteria.createViewCriteriaRow();
            Viewcriteriarow.setAttribute("ManagerId", this.getMgr());
            Viewcriteriarow.setConjunction(Viewcriteriarow.VC_CONJ_AND);
            Viewcriteriarow1.setAttribute("Salary", this.getSal());
            Viewcriteriarow1.setConjunction(Viewcriteriarow.VC_CONJ_AND);
            Viewcriteria.add(Viewcriteriarow);
            Viewcriteria.add(Viewcriteriarow1);
            if (Viewcriteria.hasData())         {
                System.out.println("Query Mode of viewobject:\t" + viewobject.getQueryMode());
                viewobject.applyViewCriteria(Viewcriteria);
                viewobject.executeQuery();
                System.out.println("no of records after apply view criteria:\t" + viewobject.getRowCount());
                System.out.println("no of records after apply view criteria:\t" + viewobject.getFetchedRowCount());
                System.out.println("no of records after apply view criteria:\t" + viewobject.getEstimatedRowCount());
                System.out.println(" view criteria where clause:\t" + viewobject.getViewCriteria());
                           System.out.println("Viewcriteria mode is:\t" + Viewcriteria.getCriteriaMode());
                System.out.println("Query Mode of viewobject:\t" + viewobject.getQueryMode());
                System.out.println("Query :\t" + viewobject.getQuery());
            else
                          Viewcriteria.removeAllElements();
                viewobject.applyViewCriteria(Viewcriteria);
                System.out.println("Viewcriteria mode is:\t" + Viewcriteria.getCriteriaMode());
                 System.out.println(" view criteria where clause:\t" + viewobject.getViewCriteria());
                           System.out.println("Query :\t" + viewobject.getQuery());
                viewobject.executeQuery();
                System.out.println("no of records after apply view criteria:\t" + viewobject.getRowCount());
                System.out.println("no of records after apply new view criteria:\t" + viewobject.getFetchedRowCount());
                System.out.println("no of records after applying new view criteria:\t" + viewobject.getEstimatedRowCount());
                System.out.println("Viewcriteria mode is:\t" + Viewcriteria.getCriteriaMode());
                System.out.println("Query Mode of viewobject:\t" + viewobject.getQueryMode());
            }Edited by: user13385388 on Jan 21, 2011 6:59 AM

    Hi,
    I'm not able to get that so I have put all the things u go through it tell me the solution please its urgent...... please guide me....
    in my application I want to execute the viewobject once using database than it should store in cache memory and after applying view criteria it should filter the data and give from the memory after clearing it it should return all the records from the cache memory no need to go database...
    I have used the following code......
    backing bean code
    public class Beanclass
        private String deptid;
        private String mgrid;
        private String sal;
        public void setDeptid(String deptid)
            this.deptid = deptid;
        public String getDeptid()
            return deptid;
        public void setSal(String sal)
            this.sal = sal;
        public String getSal()
            return sal;
        public String ROView_action()
            // Add event code here...
            FacesContext facesContext = FacesContext.getCurrentInstance();
            Application app = facesContext.getApplication();
            ExpressionFactory elFactory = app.getExpressionFactory();
            ELContext elContext = facesContext.getELContext();
            ValueExpression valueExp = elFactory.createValueExpression(elContext, "#{bindings}", Object.class);
            BindingContainer bindings = (BindingContainer) valueExp.getValue(elContext);
            DCIteratorBinding iter = (DCIteratorBinding) bindings.get("EmPdetails1Iterator"); //("employeesVo1Iterator");
            ViewObject viewobject = iter.getViewObject();
            System.out.println("no of records without applying view criteria value:\t" + viewobject.getRowCount());
            System.out.println("no of records without applying view criteria value:\t " + viewobject.getFetchedRowCount());
            System.out.println("no of records without applying view criteria value:\t" + viewobject.getEstimatedRowCount());
            System.out.println("Query Mode of viewobject before applying view criteria:\t" + viewobject.getQueryMode());
            ViewCriteria Viewcriteria = null;
            Viewcriteria = viewobject.createViewCriteria();
            Viewcriteria.setCriteriaMode(Viewcriteria.CRITERIA_MODE_CACHE);
            //Viewcriteria.setCriteriaMode(Viewcriteria.CRITERIA_MODE_QUERY | Viewcriteria.CRITERIA_MODE_CACHE);
            System.out.println("Viewcriteria mode is:\t" + Viewcriteria.getCriteriaMode());
            viewobject.setQueryMode(viewobject.QUERY_MODE_SCAN_VIEW_ROWS);
            System.out.println("Query Mode of viewobject:\t" + viewobject.getQueryMode());
            Viewcriteria.setConjunction(Viewcriteria.VC_CONJ_AND);
            ViewCriteriaRow Viewcriteriarow = Viewcriteria.createViewCriteriaRow();
            ViewCriteriaRow Viewcriteriarow1 = Viewcriteria.createViewCriteriaRow();
            ViewCriteriaRow Viewcriteriarow2 = Viewcriteria.createViewCriteriaRow();
            Viewcriteriarow.setAttribute("DepartmentId", this.getDeptid());
            Viewcriteriarow.setConjunction(Viewcriteriarow.VC_CONJ_AND);
            Viewcriteriarow1.setAttribute("ManagerId", this.getMgrid());
            Viewcriteriarow1.setConjunction(Viewcriteriarow.VC_CONJ_AND);
            Viewcriteriarow2.setAttribute("Salary", this.getSal());
            Viewcriteriarow2.setConjunction(Viewcriteriarow.VC_CONJ_AND);
            Viewcriteria.add(Viewcriteriarow);
            Viewcriteria.add(Viewcriteriarow1);
            Viewcriteria.add(Viewcriteriarow2);
            viewobject.applyViewCriteria(Viewcriteria);
            viewobject.executeQuery();
            System.out.println("no of records after applying view criteria value:\t" + viewobject.getRowCount());
            System.out.println("no of records after applying view criteria value:\t" + viewobject.getFetchedRowCount());
            System.out.println("no of records after applying view criteria value:\t" + viewobject.getEstimatedRowCount());
            System.out.println("Viewcriteria mode is:\t" + Viewcriteria.getCriteriaMode());
            System.out.println("Query Mode of viewobject:\t" + viewobject.getQueryMode());
            Viewcriteria.removeAllElements();
            viewobject.applyViewCriteria(Viewcriteria);
            //  viewobject.setQueryMode(viewobject.QUERY_MODE_SCAN_DATABASE_TABLES);
            viewobject.executeQuery();
            System.out.println("no of records after removing view criteria:\t" + viewobject.getRowCount());
            System.out.println("no of records after removing view criteria:\t" + viewobject.getFetchedRowCount());
            System.out.println("no of records after removing view criteria:\t" + viewobject.getEstimatedRowCount());
            System.out.println("Viewcriteria mode is:\t" + Viewcriteria.getCriteriaMode());
            System.out.println("Query Mode of viewobject:\t" + viewobject.getQueryMode());
            return null;
    }Jspx code
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
              xmlns:f="http://java.sun.com/jsf/core"
              xmlns:h="http://java.sun.com/jsf/html"
              xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
      <jsp:directive.page contentType="text/html;charset=UTF-8"/>
      <f:view>
        <af:document id="d1">
          <af:messages id="m1"/>
          <af:form id="f1">
            <af:pageTemplate viewId="/oracle/templates/threeColumnTemplate.jspx"
                             id="pt1">
              <f:facet name="center">
                <af:panelGroupLayout id="pgl2" layout="vertical"
                                     inlineStyle="width:1327px;">
                  <af:table value="#{bindings.EmPdetails1.collectionModel}"
                            var="row" rows="#{bindings.EmPdetails1.rangeSize}"
                            emptyText="#{bindings.EmPdetails1.viewable ? 'No data to display.' : 'Access Denied.'}"
                            fetchSize="#{bindings.EmPdetails1.rangeSize}"
                            rowBandingInterval="0"
                            selectedRowKeys="#{bindings.EmPdetails1.collectionModel.selectedRow}"
                            selectionListener="#{bindings.EmPdetails1.collectionModel.makeCurrent}"
                            rowSelection="single" id="t1" partialTriggers="::cb1"
                            width="1290">
                    <af:column sortProperty="DepartmentId" sortable="true"
                               headerText="#{bindings.EmPdetails1.hints.DepartmentId.label}"
                               id="c5">
                      <af:outputText value="#{row.DepartmentId}" id="ot11">
                        <af:convertNumber groupingUsed="false"
                                          pattern="#{bindings.EmPdetails1.hints.DepartmentId.format}"/>
                      </af:outputText>
                    </af:column>
                    <af:column sortProperty="DepartmentName" sortable="true"
                               headerText="#{bindings.EmPdetails1.hints.DepartmentName.label}"
                               id="c10">
                      <af:outputText value="#{row.DepartmentName}" id="ot3"/>
                    </af:column>
                    <af:column sortProperty="EmployeeId" sortable="true"
                               headerText="#{bindings.EmPdetails1.hints.EmployeeId.label}"
                               id="c1">
                      <af:outputText value="#{row.EmployeeId}" id="ot9">
                        <af:convertNumber groupingUsed="false"
                                          pattern="#{bindings.EmPdetails1.hints.EmployeeId.format}"/>
                      </af:outputText>
                    </af:column>
                    <af:column sortProperty="FirstName" sortable="true"
                               headerText="#{bindings.EmPdetails1.hints.FirstName.label}"
                               id="c9">
                      <af:outputText value="#{row.FirstName}" id="ot2"/>
                    </af:column>
                    <af:column sortProperty="LastName" sortable="true"
                               headerText="#{bindings.EmPdetails1.hints.LastName.label}"
                               id="c3">
                      <af:outputText value="#{row.LastName}" id="ot12"/>
                    </af:column>
                    <af:column sortProperty="Email" sortable="true"
                               headerText="#{bindings.EmPdetails1.hints.Email.label}"
                               id="c11">
                      <af:outputText value="#{row.Email}" id="ot10"/>
                    </af:column>
                    <af:column sortProperty="PhoneNumber" sortable="true"
                               headerText="#{bindings.EmPdetails1.hints.PhoneNumber.label}"
                               id="c6">
                      <af:outputText value="#{row.PhoneNumber}" id="ot7"/>
                    </af:column>
                    <af:column sortProperty="HireDate" sortable="true"
                               headerText="#{bindings.EmPdetails1.hints.HireDate.label}"
                               id="c7">
                      <af:outputText value="#{row.HireDate}" id="ot1">
                        <af:convertDateTime pattern="#{bindings.EmPdetails1.hints.HireDate.format}"/>
                      </af:outputText>
                    </af:column>
                    <af:column sortProperty="JobId" sortable="true"
                               headerText="#{bindings.EmPdetails1.hints.JobId.label}"
                               id="c4">
                      <af:outputText value="#{row.JobId}" id="ot5"/>
                    </af:column>
                    <af:column sortProperty="Salary" sortable="true"
                               headerText="#{bindings.EmPdetails1.hints.Salary.label}"
                               id="c12">
                      <af:outputText value="#{row.Salary}" id="ot8">
                        <af:convertNumber groupingUsed="false"
                                          pattern="#{bindings.EmPdetails1.hints.Salary.format}"/>
                      </af:outputText>
                    </af:column>
                    <af:column sortProperty="CommissionPct" sortable="true"
                               headerText="#{bindings.EmPdetails1.hints.CommissionPct.label}"
                               id="c2">
                      <af:outputText value="#{row.CommissionPct}" id="ot6">
                        <af:convertNumber groupingUsed="false"
                                          pattern="#{bindings.EmPdetails1.hints.CommissionPct.format}"/>
                      </af:outputText>
                    </af:column>
                    <af:column sortProperty="ManagerId" sortable="true"
                               headerText="#{bindings.EmPdetails1.hints.ManagerId.label}"
                               id="c8">
                      <af:outputText value="#{row.ManagerId}" id="ot4">
                        <af:convertNumber groupingUsed="false"
                                          pattern="#{bindings.EmPdetails1.hints.ManagerId.format}"/>
                      </af:outputText>
                    </af:column>
                  </af:table>
                </af:panelGroupLayout>
              </f:facet>
              <f:facet name="header"/>
              <f:facet name="start">
                <af:panelGroupLayout id="pgl1" layout="vertical">
                  <af:inputText label="Department Id" id="it1"
                                value="#{Viewcriteriabackingbean.deptid}"/>
                  <af:inputText label="Salary" id="it2"
                                value="#{Viewcriteriabackingbean.sal}"/>
                  <af:commandButton text="ApplyviewcriteriaUsingIteratorBindingforROView" id="cb1"
                                    partialTriggers="t1"
                                    action="#{Viewcriteriabackingbean.ROView_action}"/>
                </af:panelGroupLayout>
              </f:facet>
              <f:facet name="branding"/>
              <f:facet name="copyright"/>
              <f:facet name="status"/>
              <f:attribute name="startColumnSize" value="200"/>
            </af:pageTemplate>
          </af:form>
        </af:document>
      </f:view>
      <!--oracle-jdev-comment:preferred-managed-bean-name:Viewcriteriabackingbean-->
    </jsp:root>output:
    its returning the filtered records based on deptid and sal after removing view criteria its not returning the all the records its returns filtered records only.
    Edited by: user13385388 on Jan 25, 2011 1:58 AM

  • Applying different view criterias to af:query based different situations

    Hi all;
    Lets say i have 3 different view criterias ....and i want to apply only one of them to af:query based user's role....
    I dont have an idea how to do that...My only clue is my supervisor mentioned to me i can use page definition to do that;
    <searchRegion Criteria="DepartmentViewCriteria" Customizer="oracle.jbo.uicli.binding.JUSearchBindingCustomizer"
                      Binds="DepartmentView1Iterator" id="DepartmentViewCriteriaQuery"/>Can u help me on this matter please!
    If post is too shallow to understand i can elaborate more...
    jDeveloper 11.1.2.1.0
    Oracle DB 11g

    Create a custom public method in yr applicationmoduleImpl class. Get the viewcriteria of target vo or programmatically create yr viewcriteria.
    Based on current loggedInUser role which can be access by ADFContext.getCurrent().getSecurityContext().getUserRoles(), u can apply specific viewcriteria on VO.
    After that u can follow this link - http://dstas.blogspot.com/2010/09/adf-11g-methodaction-and-invokeaction.html, from +"We will now expose the method in the client interface of the AM"+ teopic.
    At the end u will be able to execute this method from pagedef file, whenever u enter to this page.
    Hope this helps.

  • Issue while applying View Criteria

    Hi all,
    We have a taskflow which has View Criteria as the input parameter.
    When the taskflow is invoked, the View Criteria is set in the pageFlowScope.
    Requirement is that we need to apply this view criteria to a View object.
    When we applied the view criteria to the View object and executed the query, an SQLException is being thrown
    (Missing IN or OUT Parameter at index::1)
    In the ManagedBean's method, verified if the view criteria has bindVariables:
    VariableValueManager variableValueManage = vc.ensureVariableManager();
    System.err.println("Name :"+variableValueManage.getVariableValue("pName"));
    Confirmed that the bind variable is carrying the appropriate value.
    This View Criteria when applied to the corresponding VO and executed, java.sql.SQLException is thrown:
    ViewObjectImpl testVO = gettestVO() ;
    ViewCriteriaManager vcm = testVO.getViewCriteriaManager();
    vcm.applyViewCriteria(quickSearchViewCriteria);
    testVO.executeQuery();     
    Exception: java.sql.SQLException: Missing IN or OUT parameter at index:: 1     
    In the query, the bind Variable "pName" is not binded, though the view criteria has the value.
    Thanks in advance,
    Raghu

    Hi all,
    We have a taskflow which has View Criteria as the input parameter.
    When the taskflow is invoked, the View Criteria is set in the pageFlowScope.
    Requirement is that we need to apply this view criteria to a View object.
    When we applied the view criteria to the View object and executed the query, an SQLException is being thrown
    (Missing IN or OUT Parameter at index::1)
    In the ManagedBean's method, verified if the view criteria has bindVariables:
    VariableValueManager variableValueManage = vc.ensureVariableManager();
    System.err.println("Name :"+variableValueManage.getVariableValue("pName"));
    Confirmed that the bind variable is carrying the appropriate value.
    This View Criteria when applied to the corresponding VO and executed, java.sql.SQLException is thrown:
    ViewObjectImpl testVO = gettestVO() ;
    ViewCriteriaManager vcm = testVO.getViewCriteriaManager();
    vcm.applyViewCriteria(quickSearchViewCriteria);
    testVO.executeQuery();     
    Exception: java.sql.SQLException: Missing IN or OUT parameter at index:: 1     
    In the query, the bind Variable "pName" is not binded, though the view criteria has the value.
    Thanks in advance,
    Raghu

  • Applying view criteria to LOV programmatically in ADF UI

    Hi,
    I have a LOV defined in model on VO. I want to populate this LOV programmatically based on some view criteria.
    How can I do this?
    Thanks
    - Harish

    Hi.
    Welcome to OTN.
    Check this http://www.oracle.com/technetwork/developer-tools/adf/learnmore/44-restrict-lov-169186.pdf

  • Null check for a bind variable in view criteria

    Hi, Greetings.
    I am using Jdeveloper 11.1.2.0.
    I have a view object, LocationsView, for locations table of the XE database.
    I want to apply a condition, ((:bind_var is null) or (:bind_var is not null and location_id = :bind_var), in this LocationsView.
    That is, I want to apply the condition only if the bind variable value is not null.
    How can I construct this condition using a declarative view criteria?
    Any help and hints on this regard is greatly appreciated.
    Regards,
    Guru K

    Hi,
    Thanks for the update and it is working perfectly fine.
    Now, how can I set the "ignore null values" option as checked if I am constructing the criteria programmatically using view criteria row and view criteria item at runtime.
    Thanks and regards,
    Guru K

  • Cascade LOV with multiselect in View Criteria

    Hi All,
    Is there any way to create a cascade LOV with multiselect in View Criteria.
    Ex. If a select multiple Countries from the parent LOV, the child LOV would display the list of States for the selected Countries in a view Criteria.
    Regards,
    Koushik

    Hi Jabr,
    I feel clumsy, now I have this problem.
    When I set in the format mask yyyy-MM-dd G 'at' hh:mm:ss I can use only am hours. I tried to cancel 'at' and I wrote at runtime 2011-03-23 15:30:00 but when I run it I got an error about the time format. I can use the time from 00:00:00 to 11:59:59 am.
    Thanks

Maybe you are looking for