2 Replies Latest reply: Feb 1, 2013 2:18 PM by Munna 502 RSS

    Dynamic View Criteria

    Munna 502
      Hi Gurus,

      I am new in adf and using jdev 11.1.1.4. I want to dynamically filter view object. i have create a function in AppModuleImpl class. The contents of function are here:

      public void applyViewFilter(boolean applyFilter, String itemClassValue) {
      if (!applyFilter)
      return;
      String attribName = "ItemClass";
      ViewObjectImpl vo = getItemClassMasterUpdateableView1();
      VariableValueManager vvm = vo.ensureVariableManager();
      ViewCriteria vc = vo.createViewCriteria();
      ViewCriteriaRow vcr = vc.createViewCriteriaRow();
      ViewCriteriaItem vci = vcr.ensureCriteriaItem(attribName);
      vci.setOperator(JboCompOper.OPER_EQ);
      vci.setRequired(ViewCriteriaItem.VCITEM_REQUIRED);
      VariableImpl itemClasseVar =
      (VariableImpl)vvm.addVariable("dynamicBindVarAttribute");
      itemClasseVar.setJavaType(String.class);
      itemClasseVar.setMandatory(true);
      itemClasseVar.setUpdateableFlag(Variable.UPDATEABLE);
      itemClasseVar.setVariableKind(Variable.VAR_KIND_VIEW_CRITERIA_PARAM);
      itemClasseVar.setProperty(AttributeHints.ATTRIBUTE_DISPLAY_HINT,
      AttributeHints.ATTRIBUTE_DISPLAY_HINT_HIDE);
      vci.setValue(0, ":dynamicBindVarAttribute");
      vci.setIsBindVarValue(0, true);
      vvm.setVariableValue(itemClasseVar, itemClassValue);
      vc.insertRow(vcr);
      vo.applyViewCriteria(vc);
      vo.executeQuery();
      System.out.println("Function called");

      }

      Function is compiling successfully. So in my task flow i called this function before displaying the page like Page1 -> Function Call -> Page2.
      Function executed successfully, but not applying the filter on page. I think there is something logical issue. Please guide me how i will achieve this task.

      Thanks
        • 1. Re: Dynamic View Criteria
          Wes Fang
          Have a look here:

          http://andrejusb.blogspot.com/2010/03/applying-view-criteria-from-application.html

          to quote:
          "Now most interesting part starts, you can declare View Criteria to be executed automatically, each time when View Object is accessed. You can do this in Application Module - select View Object from Data Model section and click Edit:"

          -Wes

          Edited by: Wes Fang on Feb 1, 2013 11:08 AM
          • 2. Re: Dynamic View Criteria
            Munna 502
            Thanks for reply. I am creating view criteria at run time not in design time. And is it necessary the task flow for executing function must be bounded task flow. And i am using same page some time i need to apply view criteria but some time i don't need to apply view criteria. Thanks waiting for your feedback