Add (+) clause in View Criteria

Hi Everyone,
I have a problem with a View Object. This is the query that I want to execute in my VO:
SELECT *
FROM DRG_VISIT_STEPS DrgVisitSteps, DRG_L_PROCESS_STEPS DrgLProcessSteps, DRG_VISIT_PROCESS_DEFS DrgVisitsProcessDef
WHERE (DrgVisitSteps.PROCESS_STEP_CODE = DrgLProcessSteps.PROCESS_STEP_CODE)
AND (DrgLProcessSteps.PROCESS_STEP_CODE = DrgVisitsProcessDef.PROCESS_STEP_CODE(+))
AND (DrgVisitSteps.VISIT_ID = 900)
AND (DrgVisitsProcessDef.VISIT_TYPE_CODE(+) = :BindVisitTypeCode )
ORDER BY DrgLProcessSteps.ORDINAL ASC;
The problem is this sentence: AND (DrgVisitsProcessDef.VISIT_TYPE_CODE(+) = :BindVisitTypeCode )
I'm considering to add this sentence in a View criteria or user the sentence setWhereClause.
I don't know how this should work, and if anyone can help me i would apreciate it.
Thanks in advance,
Pere.

If i understand correctly, the query
*(DrgVisitsProcessDef.VISIT_TYPE_CODE(+) = :BindVisitTypeCode )*
would translate to
*(DrgVisitsProcessDef.VISIT_TYPE_CODE = :BindVisitTypeCode )*
OR
*(DrgVisitsProcessDef.VISIT_TYPE_CODE IS NULL)*
You could define the following construct using the view criteria.
Thanks,
Navaneeth

Similar Messages

  • Programatically set where clause or view criteria not working in managed bean

    I get a view using finditerator then then apply setwhere or view criteria but it does not filter the original rows. code is as follows
    DCIteratorBinding dcIter3 =
    ADFUtils.findIterator("PlanColorsIterator");    
    ViewObject cvo = dcIter3.getViewObject();
    cvo.setNamedWhereClauseParam("Plno","4000");  // not working
       /*   // not working
    cvo.applyViewCriteria(cvo.getViewCriteriaManager().getViewCriteria("PlanColorsCriteria"));
    cvo.ensureVariableManager().setVariableValue("Plno", "4000");
    cvo.executeQuery();
    /* not working
    cvo.setWhereClause("plan_no = :ThePlanType");
    cvo.defineNamedWhereClauseParam("ThePlanType", null, null);
    cvo.setNamedWhereClauseParam("ThePlanType", "4000");
    cvo.executeQuery();

    thanks for reply.
    Jdeveloper version is 11.1.1.4.0.
    Actually the vo on which I am trying to set set where is used as source to act as cursor  to get values from filtered rows using set where and copy the this cursor values to another target vo. I am not showing these source values just getting values.
    DCIteratorBinding dcIter2 =
    ADFUtils.findIterator("PlotDtl2Iterator");     
    ViewObject dvo = dcIter2.getViewObject();
    // colors to copy 
    DCIteratorBinding dcIter3 =
    ADFUtils.findIterator("PlanColorsIterator");    
    ViewObject cvo = dcIter3.getViewObject();
    cvo.setNamedWhereClauseParam("Plno","4000");
    cvo.applyViewCriteria(cvo.getViewCriteriaManager().getViewCriteria("PlanColorsCriteria"));
    cvo.ensureVariableManager().setVariableValue("Plno", "4000");
    cvo.executeQuery();
    cvo.setWhereClause("plan_no = :ThePlanType");
    cvo.defineNamedWhereClauseParam("ThePlanType", null, null);
    cvo.setNamedWhereClauseParam("ThePlanType", "4000");
    cvo.executeQuery();
    int totalCount=cvo.getRowCount();
    cvo.setRangeSize(totalCount);
    Row[] rArray=cvo.getAllRowsInRange();
    for (Row r:rArray){
    NameValuePairs nvp = new NameValuePairs();      
    nvp.setAttribute("Description",r.getAttribute("Description"));
    nvp.setAttribute("PlanNo",r.getAttribute("PlanNo"));
    nvp.setAttribute("MainAcc",r.getAttribute("MainAcc"));
    nvp.setAttribute("Plqty",r.getAttribute("Qty"));
    nvp.setAttribute("Cdkid",r.getAttribute("CdkId"));
    nvp.setAttribute("FabricCode",r.getAttribute("FabricCode"));
    nvp.setAttribute("DyeWash",r.getAttribute("DyeWash"));
    //  nvp.setAttribute("Description","test");
    Row drow = dvo.createAndInitRow(nvp);      
    dvo.insertRow(drow); 

  • Add record through pop to search view criteria table?

    Hi,
    I am trying to add data from pop to search view criteria table but i am strukked at inserting data through popup...
    i got nullpointer exception like this
    <RegionRenderer> <encodeAll> The region component with id: pt1:r1 has detected a page fragment with multiple root components. Fragments with more than one root component may not display correctly in a region and may have a negative impact on performance. It is recommended that you restructure the page fragment to have a single root component.
    <RowGatherCallback> <processComponent> Illegal child component ("javax.faces.component.html.HtmlOutputText@17cc21b" id="j_id256") detected inside parent component ("panelGridLayout" with clientId="pt1:r1:1:pgc1:pt_pgl3"). The child component must instead be of type "gridRow" instead.
    <Utils> <buildFacesMessage> ADF: Adding the following JSF error message: java.lang.NullPointerException
    java.lang.NullPointerException
        at oracle.jbo.server.QueryCollection.getRowSetRefs(QueryCollection.java:2675)
        at oracle.jbo.server.ViewObjectImpl.notifyRowUpdated(ViewObjectImpl.java:12174)
        at oracle.jbo.server.ViewObjectImpl.afterRowUpdate(ViewObjectImpl.java:13921)
        at oracle.jbo.server.ViewObjectImpl.sourceChanged(ViewObjectImpl.java:14224)
        at oracle.jbo.server.EntityCache.sendEvent(EntityCache.java:1566)
        at oracle.jbo.server.EntityCache.deliverEntityEvent(EntityCache.java:1582)
        at oracle.jbo.server.EntityCache.notifyColumnAndBlgChange(EntityCache.java:1640)
        at oracle.jbo.server.EntityImpl.notifyAttributesChanged(EntityImpl.java:7426)
        at oracle.jbo.server.EntityImpl.notifyAttributesChanged(EntityImpl.java:7407)
        at oracle.jbo.server.ViewRowImpl.setAttributeValues(ViewRowImpl.java:1827)
        at oracle.adf.model.binding.DCDataControl.setAttributesInRow(DCDataControl.java:2447)
        at oracle.jbo.uicli.binding.JUCtrlValueBinding.setAttributeValuesInRow(JUCtrlValueBinding.java:997)
        at oracle.jbo.uicli.binding.JUCtrlListBinding.setTargetAttrsFromLovRow(JUCtrlListBinding.java:2813)
        at oracle.jbo.uicli.binding.JUCtrlListBinding.updateTargetFromSelectedValue(JUCtrlListBinding.java:2941)
        at oracle.jbo.uicli.binding.JUCtrlListBinding.setAttributeFromValueList(JUCtrlListBinding.java:2886)
        at oracle.jbo.uicli.binding.JUCtrlListBinding.setSelectedIndex(JUCtrlListBinding.java:1752)
        at oracle.jbo.uicli.binding.JUCtrlListBinding.setInputValueInRow(JUCtrlListBinding.java:3541)
        at oracle.jbo.uicli.binding.JUCtrlValueBinding.setInputValue(JUCtrlValueBinding.java:2926)
        at oracle.jbo.uicli.binding.JUCtrlValueBinding.setInputValue(JUCtrlValueBinding.java:2889)
        at oracle.adfinternal.view.faces.model.binding.FacesCtrlListBinding.setInputValue(FacesCtrlListBinding.java:458)
        at oracle.jbo.uicli.binding.JUCtrlValueBinding.put(JUCtrlValueBinding.java:2546)
        at oracle.jbo.uicli.binding.JUCtrlListBinding.put(JUCtrlListBinding.java:3437)
        at javax.el.MapELResolver.setValue(MapELResolver.java:229)
        at com.sun.faces.el.DemuxCompositeELResolver._setValue(DemuxCompositeELResolver.java:255)
        at com.sun.faces.el.DemuxCompositeELResolver.setValue(DemuxCompositeELResolver.java:281)
        at com.sun.el.parser.AstValue.setValue(Unknown Source)
        at com.sun.el.ValueExpressionImpl.setValue(Unknown Source)
        at org.apache.myfaces.trinidad.component.UIXEditableValue.updateModel(UIXEditableValue.java:361)
        at org.apache.myfaces.trinidad.component.UIXEditableValue.processUpdates(UIXEditableValue.java:311)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.updateChildrenImpl(UIXComponentBase.java:1269)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.updateChildren(UIXComponentBase.java:1259)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.processUpdates(UIXComponentBase.java:1012)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.updateChildrenImpl(UIXComponentBase.java:1269)
        at oracle.adf.view.rich.component.fragment.UIXRegion.updateChildrenImpl(UIXRegion.java:669)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.updateChildren(UIXComponentBase.java:1259)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.processUpdates(UIXComponentBase.java:1012)
        at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl$UpdateModelValuesCallback.invokeContextCallback(LifecycleImpl.java:1561)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnNamingContainerComponent(UIXComponentBase.java:1670)
        at oracle.adf.view.rich.component.fragment.UIXRegion.invokeOnComponent(UIXRegion.java:625)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1627)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1750)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1627)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1750)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1627)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1750)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1627)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1750)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1627)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnNamingContainerComponent(UIXComponentBase.java:1693)
        at oracle.adf.view.rich.component.fragment.UIXRegion.invokeOnComponent(UIXRegion.java:625)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1627)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1750)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1627)
        at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.invokeOnComponent(ContextSwitchingComponent.java:222)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1627)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1750)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1627)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1750)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1627)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1750)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1627)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1750)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1627)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1750)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1627)
        at oracle.adf.view.rich.component.fragment.UIXInclude.invokeOnComponent(UIXInclude.java:161)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1627)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1750)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnChildrenComponents(UIXComponentBase.java:1627)
        at org.apache.myfaces.trinidad.component.UIXComponentBase.invokeOnComponent(UIXComponentBase.java:1750)
        at org.apache.myfaces.trinidad.component.UIXDocument.invokeOnComponent(UIXDocument.java:106)
        at javax.faces.component.UIComponent.invokeOnComponent(UIComponent.java:1321)
        at javax.faces.component.UIComponentBase.invokeOnComponent(UIComponentBase.java:678)
        at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:382)
        at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:202)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:508)
        at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
        at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
        at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
        at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
        at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:173)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
        at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:125)
        at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
        at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
        at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
        at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:293)
        at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:199)
        at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
        at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:180)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
        at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
        at java.security.AccessController.doPrivileged(Native Method)
        at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
        at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
        at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
        at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
        at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
        at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
        at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
        at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
        at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
        at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
    can any body help me out this?..
    ThankYou

    HI,
    I think you have created form using two view objects ...recheck one of the value is null before commit ..
    Thanks
    Nitesh

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

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

  • ER: ADF BC VO View Criteria bind parameters

    Hi JDev team
    I made an interesting mistake with the new VO View Criteria today in ADF BC under TP4.
    Some days ago in an existing project I'd created a SQL-Read-Only VO, and a View Criteria with a bind variable expression (x = :pMyVar).
    Today, on revisiting the VO, I noticed that my query didn't have the bind variable in the query. I thought I'd accidentally deleted the associated where clause expression (containing the bind variable) out of the query, not realising that the bind variable was used by the view criteria expression which isn't visible in the query.
    As such as a suggestion, within the VO document window Query subwindow, is there some sort of visual indication you can add to the Bind Variables list to indicate it's used by a view criteria or otherwise the main query (or both)? This could save developers from some silly mistakes.
    Cheers,
    Chris Muir.

    Thanks Steve.
    CM.

  • View Criteria and Transient fields

    Hello, I was wondering, is it possible to have View Criteria set on a Transient field? I have created a Transient field named "Field1". I then go to the Query tab in my ViewObject and select the option "Create new view criteria". Here I select the option "Add Item" and from Attribute list I select my field "Field1". However what I notice is that the "View Object Where Clause" does not get updated when the attribute I select is a transient field - when it is a normal field (i.e. from an Entity) it does get updated. This means that I am unable to create view criteria for transient fields. Is there a way how I can manage to do this?

    Transient attributes are not based on database columns. This means that WHERE-clause on transient attributes is a non-sense. It makes sense to add conditions on transient attributes only if the view criteria will be executed as a filter in memory (see the "Query Execution Mode" property in the "Create View Criteria" dialog).

  • 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

  • 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

  • URGENT | Need HELP to build programmatic view criteria

    Hi
    I need to build programatic view criteria like below,
    ((JobId = "SH_CLERK" AND Salary > 2500) OR ( Salary > 2500))
    AND (DepartmentId =100)
    Kindly help how can we achieve this,
    The ViewCriteriaItem objects like below, how to link them to achieve like above statement.
    ViewObjectImpl empVOImpl = getEmployeesView1();
    ViewCriteria vc = empVOImpl.createViewCriteria();
    ViewCriteriaRow vcr = vc.createViewCriteriaRow();
    //criteria for employee id
    ViewCriteriaItem vci1 = vcr.ensureCriteriaItem("JobId");
    vci1.setValue("SH_CLERK");
    //criteria for showing employees whose salary are more than 10000
    ViewCriteriaItem vci2 = vcr.ensureCriteriaItem("Salary");
    vci2.setOperator(">");
    vci2.setValue(new Number(2500));
    //criteria for department
    ViewCriteriaItem vci3 = vcr.ensureCriteriaItem("DepartmentId");
    vci3.setOperator("=");
    vci3.setValue(new Number(100));
    vc.addElement(vcr);
    empVOImpl.applyViewCriteria(vc);
    - Rajesha
    Edited by: user12820425 on May 15, 2013 10:18 AM

    Hi Rajesha,
    You can follow below steps.
    1)Create VOImpl for VO on which you have query based.
    2)Remove Column(eg.JobId) from standard Default ViewCriteria
    3)In VOImpl create method to Create View custom Criteria, Add element
    public ViewCriteria  addCustomVC(){
                ViewCriteria vc = null;
                vc = this.createViewCriteria();
                vc.setName("customVC");
            ViewCriteriaRow vcRow = vc.createViewCriteriaRow();
            vcRow.setConjunction(ViewCriteriaRow.VC_CONJ_AND);
            if(getJobId() != null){ 
                vcRow.setAttribute("JobId", "' job_id = "+getJobId()+"'"); 
            }else {
                vcRow.setAttribute("JobId",null);
            vc.addElement(vcRow);
    return vc;
    }4)Override standard method public String getCriteriaItemClause to exclude above columns
        @Override
        public String getCriteriaItemClause(ViewCriteriaItem viewCriteriaItem) {
            //JobId
            if( "JobId".equals(viewCriteriaItem.getName()) ) {
                return (String) viewCriteriaItem.getValue();   
            }else{
                return super.getCriteriaItemClause(viewCriteriaItem);
        }5)Override public void executeQuery() method to add custom view criteria
    @Override
        public void executeQuery()
                applyViewCriteria(addCustomVC(), true);
                super.executeQuery();
                removeApplyViewCriteriaName("customVC");
        }Thanks,
    Jit

  • 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

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

  • How to change the view criteria at run time for af:query

    Hi,
    I've a usecase where I need to change the view criteria of the af:query at run time.
    Use case:
    =======
    1) Consider a check box (Show Emps Under Dept 10) in the query panel when user selects and clicks 'Search' button should show the employees under dept 10. If user searches without selecting the check box, the results should show all the employees in all the departments.
    2) I need to have a check box always in the query panel. Its mandatory.
    The way I implemented:
    ==============
    1) Created a transient variable 'Show Emps Under Dept 10' in the EmployeeVO and also created a bind variable bind_DeptNo.
    2) Create a view criteria 'AllEmployees' which has only the transient attribute as the view criteria item and whose value set to 'false' by default.
    3) Created another view criteria 'EmpUnderDept' which has 'DepartmentId' as the view criteria item and whose value set to the bind variable 'bind_DeptNo'.
    4) Dropped the view criteria 'EmpUnderDept' as the 'af:query' panel in the jspx page.
    5) Overridden the queryListener as '#{EmpBean.empSearch}'
    6) Has the below code in the empSearch method as below. When user selects the check box, applying the other criteria 'EmpUnderDept' and setting the bind variable to '10'.
    public void empSearch(QueryEvent queryEvent) {
    // Add event code here...
    QueryDescriptor queryDesc = (QueryDescriptor) queryEvent.getDescriptor();
    ConjunctionCriterion conCrit = queryDesc.getConjunctionCriterion();
    List<Criterion> criterionList = conCrit.getCriterionList();
    List criterionValues = new ArrayList();
    Object criteriaValue = null;
    int criteriaNo = 0;
    DCBindingContainer bc = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
    FacesContext facesContext = FacesContext.getCurrentInstance();
    for (Criterion criterion : criterionList) {
    AttributeDescriptor attrDescriptor = ((AttributeCriterion)criterion).getAttribute();
    System.out.println("============== attrDescriptor.getName() =================== " + attrDescriptor.getName());
    criteriaValue = ((AttributeCriterion)criterion).getValues().get(0);
    if(criteriaNo==0) {
    Boolean val = (Boolean) ((AttributeCriterion)criterion).getValues().get(0);
    if (val.equals(true)) {
    OperationBinding method = (OperationBinding) ADFUtil.findOperation("ExecuteWithParams");
    if(method!=null) {
    Map params = method.getParamsMap();
    //params.put(key, value)
    method.getParamsMap().put("bind_DeptId", 10L);
    method.execute();
    ADFUtil.invokeMethodExpression( "#{bindings.EmpUnderDeptCriteiaQuery.processQuery}", queryEvent);
    } else {
    //ADFUtil.invokeEL("#{bindings.ExecuteWithParams.execute}");
    ADFUtil.invokeMethodExpression( "#{bindings.AllEmployeesCriteriaQuery.processQuery}", queryEvent);
    But this approach is not working and its always showing all the employees in all the departments.
    Please let me know if there is a way to change the view criteria at run time depending on the values set at run time for one of the view criteria items.
    JDev version am using is '11.1.1.5'
    Thanks,
    Lakshman

    Hi Shay,
    It worked for me without overriding the executeQuery() method in the ViewImpl.java.
    Instead of creating 2 view criteria, I created only one which has both transient variable and the DepartmentId = <bind_DeptId>. With the above code, it worked properly. Now I am using only one view criteria.
    Thank you.

  • Bug in View Criteria for EXISTS operator

    Hello!
    I have two VO:
    DEP (ID, TITLE, STATUS)
    EMP (ID, ID_DEP, NAME)
    and viewlink DEP.ID <- EMP.ID_DEP
    in DEP VO i create view criteria and add two items:
    * DEP.STATUS <> 1000
    * the EMPVO with EXISTS operator (and after that add condition EMP.NAME contain :nName (bind var))
    start app, set "john" in search field, press button "search" and in debug console i found sql for searching in DEP:
    SELECT *
    FROM (SELECT DEP.ID,
    DEP.TITLE,
    FROM DEP DEP
    where (DEP.STATUS is null OR DEP.STATUS <> 1000)) QRSLT
    WHERE ((((EXISTS (SELECT 1
    FROM EMP EMP
    WHERE ((UPPER(EMP.NAME) LIKE
    UPPER('%' || :nName || '%')))
    AND (ID = EMP.ID_DEP))))))
    in last row present error, must be:
    AND (QRSLT.ID = EMP.ID_DEP))))))
    coz if no "QRSLT", sql parser think what need compare EMP.ID and EMP.ID_DEP.
    Present in JDeveloper 11.1.1.2.0, 11.1.1.3.0.

    We have implemented our own ViewCriteriaAdater (derived from oracle.jbo.server.OracleSQLBuilderImpl) and some custom properties to handle this. Overwrite the getFormattedRHSCompareFragment to your needs.
    Btw. I think this posting should go to the JDev forum.

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

Maybe you are looking for