Adding View Criteria Row attribute in a particular order

Hello friends,
We are using the Jdeveloper version 11.1.2.3.0.
We are populating the Query component filter programmatically , we want to show the filter order in a particular way.
The following is the code.
ViewCriteriaManager vm = view.getViewCriteriaManager();
oracle.jbo.ViewCriteria vca[] = vm.getAllViewCriterias();
oracle.jbo.ViewCriteria vc = vca[0];
vc.removeAllElements();
ViewCriteriaRow vcr = vc.createViewCriteriaRow();
vcr.setAttribute("A", "");
vcr.setAttribute("B", "");
vcr.setAttribute("C", "");
vcr.setAttribute("D", "");
vc.add(vcr);
vc.saveState();
view.applyViewCriteria(vc, true);
vm.criteriaChanged(vc);
But the filter is shown in the Query component in the following order.
C,A,B,D
Is there any way to add a filter in particular order?
Thanks in advance.
Best Regards,
Vijay

Sounds like your users are tough. You can provide your own ViewCriteriaAttributeHintsImpl and override the behaviour of HINT_NAME_FIELD_ORDER.
Create a custom ViewRowAttrHintsImpl class
public class CustomViewRowAttrHintsImpl extends ViewRowAttrHintsImpl {
@Override
public String getHint(LocaleContext locale, String sHintName) {
  if (HINT_NAME_FIELD_ORDER.equals(sHintName)) {
    //calculate and return field order here
  return super.getHint(locale, sHintName);
}Generate a ViewRowImpl and return your custom class in createViewRowAttrHints
@Override
protected ViewRowAttrHintsImpl createViewRowAttrHints(AttributeDefImpl attrDef) {
return new CustomViewRowAttrHintsImpl(attrDef, this);
}

Similar Messages

  • 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

  • Label of attribute when used as View Criteria item with Bind Variable

    I've a VO attribute used in a named search with this requirement:
    The attribute provides has an optional View Criteria item that has a bind variable operand. The bind variable is in the WHERE clause. The attribute has an LOV. The choice list for the specified View Criteria item should display the label "Effective Release". However, in all other contexts, including the search results table and the dropdowns the user can optionally add in an advanced search, the label displayed for the attribute must say "Release".
    In other words, the default label for the attribute should be "Release" in all but one context - which is that when the dropdown list for the viewCriteria item using the bind variable is displayed, the label should say "Effective Release".
    Note that if the user moves to Advanced Search and selects adds the attribute as a search criteria, this latter usage should be labeled as "Release". (in this case, in other words, the dropdown that displays by default and has the bind variable operand is labelled "Effective Release", the one the user added in advance search is labelled "Release")
    here is the View Criteria item source xml:
          <ViewCriteriaItem
            Name="ReleaseId1"
            ViewAttribute="ReleaseId1"
            Operator="="
            Conjunction="AND"
            Value=":v_ReleaseId"
            GenerateIsNullClauseForBindVars="false"
            ValidateBindVars="true"
            IsBindVarValue="true"
            Required="Required"/>I've experimented by putting "Effective Release" as the label for the bind variable as below. However, ADF does not use that value to display, it defers to the attribute value:
    <Variable
        Name="v_ReleaseId"
        Kind="viewcriteria"
        Type="oracle.jbo.domain.Number">
        <Properties>
          <SchemaBasedProperties>
            <LABEL
              ResId="EFFECTIVE_RELEASE_LOV"/>
          </SchemaBasedProperties>
        </Properties>
      </Variable>The reason for the requirement, if it matters, is that the View Criteria item with the bind variable ("Effective Release" queries a range of values using the analytic function rank(); the bind variable is in the WHERE clause. Otherwise, the dropdown that can be added in advanced search ("Release") looks for exact matches on the attribute value. So since the search functionality is different, the label should be different.
    Am using 11g.
    Thanks for your help.

    Hi
    I have found that when using validation type Key Exists and the VO is in the local application, then the bind variable is available in the Create Validation wizard. When I try and create a validator on a VO that is core to all my applications, then I put that VO into an ADF library, the bind variable parameter is not available for mapping to my entity object attribute, even though I can select the VO to create a view accessor from the ADF library.
    Possible bug?

  • Include attributes in View criteria which are outside of written query

    I have a select query which is group by on a state column
    If i use date and status columns in my above query ... then i need to include those in my group by function and my number of rows displayed is increasing based on date and status
    My use case query panel has statename, state and fromdate and todate
    Now i am able to build a view criteria on statename.... but because i have not included date and status column in my query... i am not able to include those cols in my view criteria
    Is there any chance that i can include attributes in my view criteria which is outside of my written query in vo.. i have the attributes in my table not in query

    Can this be done using transient attributes in the respective vo and using them in view criteria
    my question is how to append this attributes through view criteria to the respective query

  • Programmatically adding two view criteria

    Hello,
    I am using Jdev version 12.1.2.0.0 and i am trying to apply two view criteria to a view object:
    ViewObject vo = ...
    ViewCriteria vc1 = vo.createViewCriteria();
    ViewCriteriaRow vcr1 = vc1.createViewCriteriaRow();
    vcr1.setAttribute(smt,smt);
    vc1.add(vcr1);
    ViewCriteria vc2 = vo.createViewCriteria();
    ViewCriteriaRow vcr2 = vc2.createViewCriteriaRow();
    vcr2.setAttribute(smt,smt);
    vc2.add(vcr2);
    vo.applyViewCriteria(vc1);
    vo.applyViewCriteria(vc2,true);
    vo.executeQuery();
    I don't know why, but it executes just the second view criteria.
    Thank you in advanced.

    From the dos it looks like you add multiple rows to one view criteria but can only apply one view criteria
    public static void demoCriteria(ApplicationModule appMod)
      // Create and populate criteria rows to support query-by-example.
      ViewObject empView = appMod.createViewObject("Emp", "mypackage1.EmpView");
      ViewCriteria vc = empView.createViewCriteria();
      ViewCriteriaRow vcRow = vc.createViewCriteriaRow();
      // ViewCriteriaRow attribute name is case-sensitive.
      // ViewCriteriaRow attribute value requires operator and value.
      // Note also single-quotes around string value.
      ViewCriteriaItem jobItem = vcRow.ensureCriteriaItem("Job");
      jobItem.setOperator("=");
      jobItem.getValues().get(0).setValue("MANAGER");
      vc.add(vcRow);
      vcRow = vc.createViewCriteriaRow();
      ViewCriteriaItem salItem = vcRow.ensureCriteriaItem("Sal");
      salItem.setOperator(">");
      salItem.getValues().get(0).setValue(new Integer(2500));
      vc.add(vcRow);
      empView.applyViewCriteria(vc);
      // Multiple rows are OR-ed in WHERE clause.
      System.out.println("Demo View Criteria");
      // Should print employees that are MANAGER or have Sal > 2500
      QueryDemo.printViewObject(empView);
    Timo

  • View criteria condition needs to check value in column from another VO

    Hi All,
    My Jdev version - 11.1.1.6
    My use case is as follows-
    2 view objects say EmpVO and DeptVO which have view link with deptId as the foreign key attribute. I need to show the distinct list of departments along with a column which contains the employee names separated by comma for the particular department in the corresponding row. Hence, for DeptVO I use the query as follows -
    -          SELECT deptId,
    -                 deptName,
    -                 (SELECT listagg (empName, ',') WITHIN GROUP (ORDER BY empName)
    -                            emp_names
    -                    FROM EMP_TABLE emp
    -                   WHERE emp.deptId = dept.deptId)
    -                    emp_names
    -            FROM DEPT_TABLE
    This gives me the result on screen as follows -
    DeptId          DeptName          EmpNames
    101               HR                    emp1,emp2
    102               Finance             emp3,emp4,emp5
    Now, my requirement is that there should be a search on department which should also contain an LOV (with search icon) for the employee names i.e. if user selects emp4 from the LOV, department table should list the record for 102.
    For this , I added an LOV on the EmpNames attribute of DeptVO (to map the values from EmpVO) and added a view criteria based on which I added a query panel on screen and the relevant partialTrigger attribute so that the department table should reflect the search results. I tried 2 options in the View Criteria of DeptVO i.e.
    1. Added an Item 'EmpNames = '. WIth this, EmpNames attribute appear with Searh icon in the query panel(which is required) but it does not display the right department record bcz it tries to match exactly with values like 'emp3,emp4,emp5'
    2. If I add Item 'EmpNames CONTAINS ' , EmpNames search will work from query panel i.e. if I enter the value as emp4, department 102 will be shown in the results table but there is no Search icon on the EmpNames field in query panel. The component actually becomes an inputText.
    It would be of great help if you can guide on a better way to achieve this use case. Please let me know if there needs to a change in the approach or if any other details are needed.
    Regards,
    Ansh

    Hi Timo,
    Thanks for this. I have already implemented this part. Here, in the example there's an LOV on department id and form is on employee entity. However, my use case is a different one. I need to search for department which should contain a search criteria for employee in the form of LOV.
    Could you suggest some possible solution?
    Regards,
    Ansh

  • 11g View Criteria "Exists" Problem!!

    Jdeveloper Version 11.1.1.1.0
    Example: Model HR
    Hi everybody,
    I am using the example model HR and i would like to get a view criteria to search the departments by name and employees by the lastname. But i need to get the departments when the "firstNameEmployee" is empty even though they are no employees.
    Now i get only the departments with some employee.
    That is a example of my concrete problem. In the view must have only the attributes of department.
    and here is the query:
    ( ( ( UPPER(Departments.DEPARTMENT_NAME) LIKE UPPER('%' || :VariableNameDepartament || '%') ) OR ( :VariableNameDepartament IS NULL ) )
    AND (EXISTS(SELECT 1 FROM EMPLOYEES Employees WHERE ( ( ( UPPER(Employees.LAST_NAME) = UPPER(:VariableNameEmployee) ) OR ( :VariableNameEmployeeIS NULL ) ) )
    AND (Departments.DEPARTMENT_ID = Employees.DEPARTMENT_ID))) )
    Thanks!

    Hi,
    Using view criteria does not change anything. After the query, the view object only contains the filtered rows.
    So you can get the result the same way you did before.
    Gabriel.
    ps: I hope I got your use case correctly. If not please give us some more detail
    Edited by: Gabriel Sideras on Sep 27, 2011 3:01 PM

  • Outer join in view criteria: how to ?

    Hello,
    I have to create a VO for a LOV. I created in this VO a ViewCriteria to pass variables for the query.
    The problem is that for one of this variable I have to set the clause as an outer join.
    JDeveloper creates:
    SELECT MyView1.Item, MyView2.Code
    FROM MyView1, MyView2
    WHERE MyView1.ID = MyView2.EXT_ID (+)
    AND MyView1.Item = :TheItem
    AND MyView2.Code = :TheCodebut I need something like:
    SELECT MyView1.Item, MyView2.Code
    FROM MyView1, MyView2
    WHERE MyView1.ID = MyView2.EXT_ID (+)
    AND MyView1.Item = :TheItem
    AND :TheCode = MyView2.Code (+)

    ADFboy wrote:
    this is optional parameter value, in the view criteria windows is this option....
    AdfBoyNo, this parameter is not optional because, in the call of the LOV it will be always set.
    But the query without the outer join returns too few rows...
    I tried to find where to "intercept" this programmatically, but I'm failing doing this. :(
    I'll have the same problem with another field, not for a LOV but to get the value of an attribute of a VO.
    Even in advanced mode the Where clause can't have parameters...

  • Issue in Creating an "EXISTS" View Criteria

    Hi,
    Jdev -11.1.1.5.0
    Following is the usecase to apply 'Exists' View criteria.
    We have one NodesEO and two VOs (NodesVO & TopicsVO) which are from same NodesEO.
    NodesVO=> Used to form tree structure . Filtering topics with topic_type is null
    SELECT * FROM MD_TOPICS NodesEO WHERE NodesEO.TOPIC_TYPE is null and doc_name is not null ORDER BY NodesEO.DOC_NAME
    TopicsVO=> Used to prepare ADF table based on selected tree nodes. Filtering nodes with topic_type is not null
    SELECT * FROM MD_TOPICS NodesEO WHERE NodesEO.TOPIC_TYPE is not null
    Issue: As of now, iam preparing list of selected nodes from tree and then sending the comma separated string to IN clause.
    As there is limitation for maximum number of expressions in a list is 1000.
    Iam trying to Create an 'EXISTS' View Criteria. So i got reference to implement the same.
    http://one-size-doesnt-fit-all.blogspot.in/2011/02/adf-bc-creating-exists-view-criteria.html
    Look like, we need to have ViewLink to create EXISTS VC. I tried to create VL from TopicsVOToNodesVO. At the end, I dragged the TopicsVO instance as a table on jsff.
    Here iam unable to filter the rows from NodesVO based on checkbox status.
    Iam using transient attribute (checkboxConfirmedStatus- String, checkboxCOnfirmed- boolean). Here i've applied VC on transient attribute by selecting 'In memory' option.
    At run time, iam getting exception.
    <QueryCollection> <buildResultSet> [1729] java.sql.SQLException: Attempt to set a parameter name that does not occur in the SQL: bind_checkboxConfirmed
    Please suggest any option to filter the rows from NodesVO based on checkbox (transient attribute) status before applying 'Exists' clause.
    Let me know, if I am in wrong process.
    Thanks in advance,
    Samba.

    Can some one suggest on our issue?
    Thanks,
    Samba.

  • Looking for hook into a mb method on page load of jsff with auto query on view criteria.

    Hello,
    I have a View Criteria that is set to Query Automatically (showing data to match today's date).  The target table has a detail table and there is a control that shows parsed XML from the current row in the detail table into a table that I build dynamically. The main table and the detail table show the proper data on page load but the table for the parsed XML is empty.  The dynamic table is bound to a managed bean where the parsing is done and data is created.  I have the control refreshing properly on a row change of the main and detail tables and on a queryListener for the view criteria.
    This is for a jsff page. I have been trying a bunch of approaches with no success.  The detail table has a ppr to the main table and the query.  I am looking some event on either the query, the main table or the detail table where I can make a call to my managed bean to parse the XML, build the table and refresh the control.  I have an attribute binding to the XML data (when I placed it in a control as plane XML it refreshed properly).  I only need this on initial page load or first time the tables are populated, I have the other use cases covered.
    Running JDev 11.1.2.4
    Thank you
    Rudy

    ok but where?
    i have read a topic about "setRefreshOption", but i need a component to execute it.
    i have read a topic about a false criteria (1=2), and when i want search, i remove it, but again, i need a component to execute it.
    i have read a topic about ${adfFacesContext.postback == true} to write into iterator proeprty, but i haven't this view into my appmodule.
    i'm really sorry, but please, can you explain me a little ?
    Edited by: bradici on 8 oct. 2009 16:36

  • 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.

  • Oracle.jbo.NoDefException: Error in Quick Search when we use View  Criteria

    We encountered NoDefException error in Quick Search. We are using JDeveloper 11.1.1.6.0, JHeadstart 11.1.1.4
    I am able to reproduce the error by applying Oracle's HR schema. The following are the steps to reproduce with HR schema:
    1. Create an employee view named EmpVw by using the following query:
    select
    employee_id,
    first_name,
    last_name,
    email,
    phone_number,
    salary
    from employees
    2. Create a lookup view named CountryLookupView by using the following query:
    select
    country_id,
    country_name
    from countries
    3. Create a view named EmpCountryVw by using the following query:
    select
    emp.employee_id,
    emp.first_name,
    emp.last_name,
    cnty.country_id,
    cnty.country_name
    from employees emp
    inner join departments dept
    on emp.department_id = dept.department_id
    inner join locations loc
    on dept.location_id = loc.location_id
    inner join countries cnty
    on loc.country_id = cnty.country_id
    4. Create a LOV for the CountryId attribute in EmpCountryVw. The data source for this LOV is the CountryLookupView we just created. UI hints list type is Input Text with List of Values.
    5. Create View Criteria for EmpVw view, name it as EmpVwSearchCriteria Select EmpCountryVw from Attribute list, Operator is Exists, Operand is Inline View Criteria.
    6. Create new service EmployeeSearchService. Select EmpVw to the data model.
    7. In JHeadStart Application Definition Editor, create a new service node EmloyeeSearchService, set EmpVwSearchCriteria as Quick Search View Criteria in Search Settings section. Run the JAG, and then run the application.
    8. On the application screen, select EmployeeSearchService from the module drop-down list, on Emp Vw screen, click the glass icon to display the pop-up country search dialog, type in CA as country code, run the search, select the row with "Ca Canada" and then click OK button to close off the pop-up dialog. on Emp Vw screen, click "->" to run the search with Country Id = CA. Note the error dialog popup.
    The error message is: oracle.jbo.NoDefException: JBO-25058
    Caused by: oracle.jbo.NoDefException: JBO-25058: Definition data_MyJhsTutorial_UIShellPageDef_mainRegion_oracle_hr_pageDefs_EmpVwPageDef_WEB_INF_adfc_config_EmpVw_xml_EmpVwTaskFlow_EmpVwIteratorEmpVwSearchCriteriaQuery.vcrow125.EmpCountryVw.EmpCountryVwNestedCriteria.vcrow128.CountryId of type Attribute is not found in EmpVw.
         at oracle.jbo.server.ViewObjectImpl.findAttributeDef(ViewObjectImpl.java:7310)
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding._isTransientAttribute(FacesCtrlSearchBinding.java:585)
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding._changeQueryModeIfNeeded(FacesCtrlSearchBinding.java:577)
         at oracle.adfinternal.view.faces.model.binding.FacesCtrlSearchBinding.processQuery(FacesCtrlSearchBinding.java:397)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         ... 63 more
    Please let me know if you have solution for this error. Thanks in advance.
    Sarah

    Sarah,
    I could reproduce the error.
    However, I created a drag-and-drop page fragment with quick search and table, and modified the adfc-config-EmpVw task flow to reference the drag and drop page:
    <view id="EmpVwTable">
    <page id="__120">/EmpvwDD.jsff</page>
    </view>
    And then I still get the same error, so this looks like an ADF bug to me.
    I also created a stand-alone jspx page using drag and drop, same error as well. I suggest you make a testcase without JHeadstart and contact Oracle Support.
    Steven Davelaar,
    JHeadstart Team.

  • Passing two values in two different views using view criteria in adf bc

    I have two tables. Message and MessageProperties. Message table is connected with itself as same as Employee table of HR. Means a Message can have various child message. MessageProperties contains the message properties. A message can have various properties. I want to show the message only if it has a particular value in MessageProperties,then its properties,its child message. If its child message have the same value in MessageProperties,then it shows that. Likewise it should give me a tree structure with its all properties.
    When I am hardcode the value then its shows fine.
    SELECT Message.MESSAGE_ID,
    Message.MSG_CONTENT_ID,
    FROM MESSAGE Message, MESSAGE_PROP MessageProp
    WHERE (MessageProp.Message_Id=Message.Message_Id) AND ((MessageProp.Key='From' OR MessageProp.Key='To') AND (MessageProp.value='B'))
    But when I use the Bind variable in view criteria then I am not able to achieve this.
    1. How to do that in adf bc and how to link message and messageprop with this condition?
    2. How to pass two parameters in serviceinterface FIndViewCriteria method i.e. messageId and value so that it will show only that message having that value?

    Thanks Timo,
    It helps me a little bit.
    It only shows me the parent message id and its properties. But it is not showing its child message id and its properties.
    Let me explain you step by step what I have done.
    1> I have created a view MessageView with two entities i.e Message and MessageProp and include the value attribute of MessageProp in it.
    2> I have created the default MessagePropView from MessageProp Entity.
    3> In MessageView I have modified the query which you have given.
    4> I have created the Bind variables.
    5> I have created a view criteria and in that view criteria I have included Message_Id=:Bind_MessageId and Value=:Bind_Value.
    6> I have created an association connecting Message.Message_Id and Message.Parent_Id(1 to * cardinality) because a message can be a parent of many messages.
    7> I have created a viewlink between Message and MessageProp using Message_Id.
    8> I have created a view link between Message and Message using the association which I have created in step 6.
    9> I have created the Application Module. In that,my Data Model looks like
    ---MessagePropView2
    ---MessageView1
    ---------MessagePropView1
    ---------MessageView2
    10> Then I have created the service interface. In service interface view instances,I include these two view and select the GetByKey operation from basic operations.
    11> From View Criteria find operations I have included the view criteria which I have created in message view in step 5.
    12> Then I run the AppModuleServiceImpl.java and select the view criteria operation which I have created in step 11.
    13> There I find two bind variables i.e. Bind_MessageId and Bind_Value. I give the values there.
    But it checks whether that message Id(Bind_MessageId) which I have given have that value(Bind_Value) or not. If it has then it shows only that message along with its properties but it is not showing me its childs and their properties.
    I want to show only those child message who have the MessageProp.value as (Bind_Value).
    I hope you understand with the scenario.
    I'll be very thankfull to you if you help me to do this.
    Rohit.

  • 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

  • How to reset view criteria in transient view object

    Hi,
    I have a view object with one transient attribute:
    ViewCriteria vc = null;
    ViewCriteriaRow vcRow = null;
    ViewObject vo = am.findViewObject("TestView");
    vo.setQueryMode(ViewObject.QUERY_MODE_SCAN_VIEW_ROWS);
    Row newRow1 = vo.createRow();
    newRow1.setAttribute("TestAttr", new Number(10));
    vo.insertRow(newRow1);
    Row newRow2 = vo.createRow();
    newRow2.setAttribute("TestAttr", new Number(20));
    vo.insertRow(newRow2);
    ViewCriteria vc = null;
    ViewCriteriaRow vcRow = null;
    vc = vo.createViewCriteria();
    vc.setCriteriaMode(ViewCriteria.CRITERIA_MODE_CACHE);
    vcRow = vc.createViewCriteriaRow();
    vcRow.setAttribute("TestAttr", new Number(10));
    vc.addElement(vcRow);
    vo.applyViewCriteria(vc);
    vo.executeQuery();
    System.out.println("Rows: "+vo.getEstimatedRowCount());  // Works as expected
    vo.getViewCriteria().resetCriteria();  // This code should reset view criteria
    vc = vo.createViewCriteria();
    vc.setCriteriaMode(ViewCriteria.CRITERIA_MODE_CACHE);
    vcRow = vc.createViewCriteriaRow();
    vcRow.setAttribute("TestAttr", new Number(20));
    vc.addElement(vcRow);
    vo.applyViewCriteria(vc);
    vo.executeQuery();
    System.out.println("Rows: "+vo.getEstimatedRowCount());  // Returns 0 rows - should return 1How to reset and apply view criteria ?

    try to remove the previously view criteria. ie
    ViewObjectImpl vo = this.getSomeViewObject();
    ViewCriteria vc = vo.getViewCriteria("criteria_name");
    vo.removeViewCriteria("criteria_name");
    vc.resetCriteria();
    vo.applyViewCriteria(vc);
    see the link below
    http://adfcodebits.blogspot.com/2010/04/bit-7-reseting-view-criteria-associated.html

Maybe you are looking for

  • QR Code Reader app resets device

    I have installed three QR code reader applications from three different companies, and I get the same result from each.  The apps successfully downloaded to my 8520, but when I use the app to "snap" the QR code, my 8520 just resets itself, without ta

  • The Content-type: header

    When I send a new message, Mail sets the Content-type header to Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Most of the time it does the same for replies that I send. Sometimes however on a reply it instead sets Content-Type:

  • A Strange Error occurs while RUN (Need Help)

    C:\j2me\projects>javac -target 1.1 -g:none -bootclasspath %MIDPClasses% KeyEventTest.java C:\j2me\projects>preverify -classpath %MIDP_HOME%\classes;. -d . KeyEventTest C:\j2me\projects>midp -classpath %MIDP_HOME%classes;. KeyEventTest ALERT: Error ve

  • Press the esc key for startup menu

    My HP mini netbook won'tload to the start-up page.  I'm using Windows 7. I get the following messgae "Press the Esc key for startup menu" but when I do nothing happens.

  • Explain plans for Iphone Please!

    hello, my verizon contract is up in 2 months and i will probably switch to att for the iphone. i have 4 people in my family and am looking at getting 2 or 3 iphones. what plan should i get? and is the data plan 30$ per iphone or can you get a plan th