How to access query based view object in backing bean

Hi
I am using JDev11.1.2.1.0
I want to use the query result of query based view object in backing bean.
How can i do the same
Please Solve this
Thanks

Hi,
Assuming ADF is in the picture
1. Create a PageDef file for the page (right mouse click "Go to Page Definition")
2. In the Executable section, create an iterator for the View Object
3. In the managed bean:
BindingContext bctx = BindingContext.getCurrent();
BindingContainer bindings = bctx.getCurrentBindingsEntry();
DCIteratorBinding iter = (DCIteratorBinding ) bindings.get("name of Iterator");
iter.execute();
// ... navigate the iterator rows ...//
Frank

Similar Messages

  • Implementing History types on query based view object attributes

    Hi All,
    I have to implement the history types
    created on,
    created by,
    modified on,
    modified by
    in my application, but I have all the Query based view objects in my work space, but according to my research History types can only be implemented on the Entity Objects attributes. So how can I do this for my application ? Any Solution ? Any alternative  please ?
    (NOTE: I have all the entity objects available in my common Model work space ).

    @TimoHahn, I have the following master view object query, which i can not generate by using the Entity objects, Basically I am transforming an oracle form base ERP into Oracle ADF application, so I have available all the quries , Please let me know if i can have any alternative solution ?
    SELECT  NVL(A.STYP,0) STYP,A.DAT,C.BATNO,C.ITST, B.DEMNO,B.ITEM,LTRIM(RTRIM(D.ITEMNAME))ITEM_NAME,0 TRINQ,D.UOM ABRV,P.DAT DDAT,
        A.CSNO,PARTY,NVL(CSRAT,0)+(NVL(CSRAT,0)*NVL(B.GST,0))/100 GSTCSRAT,CSRAT,
        A.PDAYS DAYS, DECODE(C.CSTERM,1,'CASH',2,'CREDIT',3,'DD',4,'PAY ORDER',5,'ADVANCE%',6,'CHEQUE') ,B.GST,E.MASTDS PNAME,NVL(SUM(B.RQTY),0)DRQTY,DEPT.SEC_NAME DEPTDS,SUM(STOK.QTY) BAL,P.TRNO,C.EBY, C.SYSIP, C.TDAT
                  FROM ACCSTORE.STAC_CSM A, ACCSTORE.STAC_CSD B,ACCSTORE.ST_STAC_DEM_APRVD C,ACCSTORE.VITEMS D, ACC_MAST E,ACCSTORE.PRE_DEMANDM P,ACCSTORE.VSECTIONS DEPT,
                  (SELECT STYP,ITEMID,SUM(BALANCE) QTY FROM ACCSTORE.VITEMSTOCK GROUP BY STYP,ITEMID) STOK
                  WHERE A.CSNO=B.CSNO AND B.CSNO=C.CSNO AND B.DEMNO=C.DEMNO AND B.ITEM=C.ITEM AND B.STYP=C.STYP  AND C.PDEMNO=P.TRNO(+) AND P.DEPT=DIVNO AND P.SEC_NO=DEPT.SECNO(+)
                              AND C.STYP=STOK.STYP AND C.ITEM=STOK.ITEMID
                    AND C.STYP=D.STYP AND C.ITEM=D.ITEMID AND C.PARTY=E.MASTCD  AND B.APP=1 AND NVL(C.PONO,0)=0 
                    AND C.ITST=DECODE(C.STYP,0,11,14)
                    GROUP BY NVL(A.STYP,0),A.DAT,C.BATNO,C.ITST,B.DEMNO,B.ITEM,D.ITEMNAME,A.CSNO,PARTY,P.DAT,DEPT.SEC_NAME,P.TRNO,C.EBY, C.SYSIP, C.TDAT,
                    CSRAT,A.PDAYS,C.CSTERM,B.GST,E.MASTDS,D.UOM ORDER BY A.CSNO,D.ITEMNAME
    ORDER BY "DAT" DESC
    which i can not generate by using the Entity objects, Basically I am transforming an oracle form base ERP into Oracle ADF application, so I have available all the quries , Please let me know if i can have any alternative solution ?

  • Getting data from view object into backing bean

    Hi,
    My requirement is explained below -
         I have a ADF editable table in a jsf page which is connected to backend database table. In the table there are 6 columns and only 2 are editable. So when user inputs a value in first input column an event is triggered such that the data for all the remaining columns should be fetched from another database table.
    Typically if we are not using ADF development environment. We would have had a simple business method which creates the sql query by taking the input from textbox with simple where clause and I would have got the data. I am not getting any idea how to do this in ADF. I have the second table as view object but how to access the view object from backing bean and get data based on the input given.

    Hi,
    step 1) Expose a method on the ViewObject Impl class
    step 2) define arguments for the method as needed to identify the row to read data from
    step 3) retrieve the row from the VO that holds the data you want to add and return a HashMap with this information
    step 4) expose the method on the client interface (Java menu selection on the View Object)
    step 5) In the PageDef file, create a method binding to the method you exposed on the ViewObjectImpl
    step 6) Call the method binding from the managed bean like
    OperationBinding getDataFromVO = (OperationBinding) BindingContext.getCurrent().getCurrentBindingsEntry().get("Name of method binding);
    getDataFromVO.getParamsMap().put("name of arguments1", value1);
    getDataFromVO.getParamsMap().put("name of arguments2", value2);
    Object retData = getDataFromVO.execute();
    if(retData != null && getDataFromVO.getErrors().size()==0){
      HashMap retDataMap = (HashMap) retData;
    ... follow the rest of your logic ....
    Frank

  • How do I query changed view object attribute in another view object

    Jdeveloper 10.1.3.4
    My requirement is that I want to be able to query a view object (based on entity) on a non-key attribute where the value I am searching on may either be in the database on an existing record or, have just been recorded by updating a different view object based on the same entity (and yet to be committed).
    When querying the second view object for a value just updated via a different view object, the second view object always returns no rows. I had expected the process to be :
    EntityA
    ViewObjectA based on EntityA
    ViewObjectB based on EntityA
    ViewObjectA - query row with key = 123. update attribute Y with value 456 (attribute Y in database null). Entity cache for EntityA, key 123, atttribute Y updated with value 456
    ViewObjectB - query row with attribute = Y. expect record in EntityA cache just updated to be returned. Instead, nothing is returned
    Here is the code I was using (where RandScheduleEdit and RandScheduleSearch are identical view objects based on entity object RandSchedule)
      public static void main(String[] args) {
        String        amDef = "test.cache.model.AppModule";
        String        config = "AppModuleLocal";
        ApplicationModule am = Configuration.createRootApplicationModule(amDef,config);
        ViewObject rsEdit = am.findViewObject("RandScheduleEdit");
        Key rsKey = new Key(new Object[]{40});
        Row[] rsEditRows = rsEdit.findByKey(rsKey,1);
        Row rsEditRow = rsEditRows[0];   
        rsEditRow.setAttribute("SId", new Number(7827));
        ViewObject rsSearch = am.findViewObject("RandScheduleSearch");
        rsSearch.setWhereClause("S_ID = :SId");
        rsSearch.defineNamedWhereClauseParam("SId", null, null);
        rsSearch.setNamedWhereClauseParam("SId",new Number(7827));
        rsSearch.executeQuery();
        Row rsSearchRow = rsSearch.first();
        Configuration.releaseRootApplicationModule(am, true);
      }Why does rsSearch not find the record S_ID = 7827 ? It seems to only be querying new records in the database and ignoring the cached record just updated ?
    Any help greatly appreciated.
    Cheers,
    Brent

    rsSearch.setNamedWhereClauseParam("SId",new Number(7827));This might help:
    rsSearch.setQueryMode(ViewObject.QUERY_MODE_SCAN_ENTITY_ROWS);
    rsSearch.executeQuery();

  • Modifying where clauses for View Objects in Backing Beans

    In studying the RichTable class I saw no get/set methods that would allow me to manipulate the underlying view instance and rowset for the table in the Backing Bean. I know there is a way to do it, but I having great difficulty in finding it. The tutorials show how to build view objects and display them, but I haven't seen a tutorial that show how to respond to events from the Web page and directly change the data model and what is displayed via the backing bean.
    Can some one point to a tutorial or give me an example on how I can change a view object via a backing bean?

    What you want to do is add a method to your View Object Implementation class that changes the WHERE clause with setWhereClause or addWhereClause. Expose the method to your client. Then call the method from your page by binding it to a commandButton or commandLink. You can bind it through a pageDef file or a backing bean.

  • How to sort view object in backing bean

    Hello all ,
    I want to dispaly read only table in sortable way depending on one of attribute value.
    in backing bean I am trying to execute query by executeQuery method but it didn't work
    I have put column sort property to true but it does not work..
    please help me..
    I am using Jdevloper 11.1.1.2.0
    If any one required more details please post

    Hi,
    One way to achieve this is, add a method in your vo which does something like this
      public void customSortBy(String columnName){
      this.setOrderByClause(columnName);
      this.executeQuery();
      }Expose this method as client interface and add it to your pagedef as method binding.
    Once you are done, you can execute method from backing bean by passing the sorting parameter according to your need.
    -Arun

  • How to build sql query for view object at run time

    Hi,
    I have a LOV on my form that is created from a view object.
    View object is read-only and is created from a SQL query.
    SQL query consists of few input parameters and table joins.
    My scenario is such that if input parameters are passed, i have to join extra tables, otherwise, only one table can fetch the results I need.
    Can anyone please suggest, how I can solve this? I want to build the query for view object at run time based on the values passed to input parameters.
    Thanks
    Srikanth Addanki

    As I understand you want to change the query at run time.
    If this is what you want, you can use setQuery Method then use executeQuery.
    http://download.oracle.com/docs/cd/B14099_19/web.1012/b14022/oracle/jbo/server/ViewObjectImpl.html#setQuery_java_lang_String_

  • Is it possible the query in view object is dynamic?

    Is it possible the query in view object is dynamic?
    Generally, make the column list dynamic.
    I think this is related to whether view object can be assembled at runtime based on a dynamic cursor in a procedure?
    I ask this because I would like to know how we can use OA framework to simulate crosstab workbook in Discoverer?
    Anybody has some clues, please advise.
    Thanks.

    Hi Shay,
    Let me tell you briefly... I am sending input as customerId,customerNumber,CustomerName to the web service, if the record is available i am getting the response and i am displaying those records on page as a table. Now when i click a row i need to populate another table with all sale orders of that customer. From webservice datacontrol i have only customer object, I dont have Sales Order Object. For this i need master detail relation. In this case how to proceed. Thats why i am thinking to create a vO and EO object for sales orders table and i want to create view link for this sales order and customers. As i don't have customer VO and EO object to create view link.

  • How to reference the Parent view Object attribute in Child View object

    Hi , I have the requirememt to generate Tree like struture to display Salary from joining date to retirement date in yearly form.I have writtent two Pl/SQL function to return parent node and child nodes(based on selected year).
    1.First function --> Input paramter (employee id, retirement date , joining date) --> return parent node row with start_date and end_date
    2. 2nd function --> input paarmter(employee id, startDate, end_date) --> return child node based on selected parent node i.e. start date and end date
    I have created two ADF view object based on two function return
    Parent Node --> select * from Table( EUPS.FN_GET_CONTR_SAL_BY_YR(employeeId,retirement Date, dateOf joining)) ;
    Child Node --> select * FROM TABLE( EUPS.FN_GET_CONTR_SAL_FOR_YEAR( employeId,startDate, endDate) ) based on selected parent node.
    I am giving binding variable as input for 2nd function (child node) . I don't know how to reference the binding variable value in child view from parent view.
    Like I have to refernce employeId,startDate, endDate values in 2nd function from parent view object. some thing like parentNode.selectedStart_date parentNode.employeeId.
    I know we can achive this writing the code in backing bean.But i want to know how can we refernce parent view object attribute values in child view object using Groovy or otherway?
    I will appreciate your help.
    Thanks

    I have two view com.ContractualSalaryByYearlyView for Parent Node and com.ContractualSalaryByYearlyView for child Node.
    I have created view link(ContractualSalYearlyByYearViewLink) betweem two view by giving common field empId, stDate , endDate.(below is the view link xml file).
    I tried give the binding attribute values using parent object reference like below in com.ContractualSalaryByYearlyView xml file but getting error
    Variable ContractualSalaryByYearlyView not recognized.I think i am using groovy expression.
    Thanks for quick response.
    com.ContractualSalaryByYearlyView xml
    <ViewObject
    <DesignTime>
    <Attr Name="_isExpertMode" Value="true"/>
    </DesignTime>
    <Variable
    Name="empId"
    Kind="where"
    Type="java.lang.Integer">
    <TransientExpression><![CDATA[adf.object.ContractualSalaryByYearlyView.EmpId]]></TransientExpression>
    </Variable>
    ContractualSalYearlyByYearViewLink.xml file
    <ViewLinkDefEnd
    Name="ContractualSalaryByYearlyView"
    Cardinality="1"
    Owner="com.ContractualSalaryByYearlyView"
    Source="true">
    <DesignTime>
    <Attr Name="_finderName" Value="ContractualSalaryByYearlyView"/>
    <Attr Name="_isUpdateable" Value="true"/>
    </DesignTime>
    <AttrArray Name="Attributes">
    <Item
    Value="com.ContractualSalaryByYearlyView.EmpId"/>
    <Item
    Value="com.ContractualSalaryByYearlyView.StDate"/>
    <Item
    Value="com.ContractualSalaryByYearlyView.EndDate"/>
    </AttrArray>
    </ViewLinkDefEnd>
    <ViewLinkDefEnd
    Name="ContractualSalaryForYearView"
    Cardinality="-1"
    Owner="com.ContractualSalaryForYearView">
    <DesignTime>
    <Attr Name="_finderName" Value="ContractualSalaryForYearView"/>
    <Attr Name="_isUpdateable" Value="true"/>
    </DesignTime>
    <AttrArray Name="Attributes">
    <Item
    Value="com.ContractualSalaryForYearView.EmpId"/>
    <Item
    Value="com.ContractualSalaryForYearView.StDate"/>
    <Item
    Value="com.ContractualSalaryForYearView.EndDate"/>
    </AttrArray>
    </ViewLinkDefEnd>

  • Problems with query in view object

    I have create query form view object that is render on a jsp. The dynamic generate query leaves out "'" single quotes on string 'not assigned' which is selected from a lov.
    Does anyone no how I might fix this?
    Thanks.

    Greg:
    Please provide further details. How are you creating the dynamically generated query? Could you show the original query vs. what is executed?
    Thanks.
    Sung

  • Expert mode query in View objects and appended where clause

    My company is Oracle Member Partner and we are developing enterprise web applications using Oracle database and BC4J.
    I have the following problem...
    When I enable EXPERT MODE option in View Object I have trouble appending to query statement in my client code.
    I need expert mode because I must use "SELECT DISTINCT" insted of "SELECT" in my query.
    It looks something like this:
    viewObject.setWhereClause("CLA_ID = " + claId);
    viewObject.executeQuery();
    SQL query from View Object becomes sub-query and fails to execute:
    select * from (original view object query) where (... appended where clause)
    Order by part of the query causes sql errors because original query is now sub-query.
    Is there any way around this?

    I tried creating an expert mode SQL query:
    SELECT DISTINCT EMPNO, ENAME FROM EMP.
    Then at runtime I do:
    vo.setWhereClause("ENAME LIKE '%'||?||'%');
    vo.setWhereClauseParam(0,'A');.
    and this works fine. The trick is that since expert-mode view objects get wrapped as inline views (to allow runtime appending of WHERE clause, actually), you need to select any column in the select statement to which you want to later refer in a dynamically-appended where clause.
    If you want to prevent the inline-view wrapping, you can write the following code in your view object's ViewObjectImpl subclass to force the VO to NOT be treated as an expert-mode SQL VO.
      // Goes in your view object impl subclass
      public void create() {
         // Force this VO to NOT be treated as an expert-mode SQL, so that
         // its query does not get wrapped as an inline view.
         getViewDef().setFullSql(false);
      }I used this trick above to create an expert mode query like:
    SELECT DISTINCT deptno FROM empand then at runtime I add a dynamic where clause that refers to a column
    in EMP that is not in the select list like this:
        ViewObject vo = am.findViewObject("View1");
        vo.setWhereClause("ename like '%A%'");
        vo.executeQuery();
        System.out.println(vo.first().getAttribute(0));and this causes the query to come out as:
    SELECT DISTINCT deptno FROM emp WHERE ename like '%A%'.
    instead of:
    SELECT * FROM (SELECT DISTINCT deptno FROM emp) QRSLT WHERE ename like '%A%'which would cause an error due to the fact that ename is not in the select list of the original (wrapped, inline) query.

  • How to refresh the input text value in backing bean

    hi all
    i want to know
    how to refresh the input text value in backing bean?
    i have tried this code ,but it doesnt work
    public void click(ActionEvent actionEvent) {
    tempConId.setValue("111111111111111");
    AdfFacesContext.getCurrentInstance().addPartialTarget(tempConId);
    sb know?
    Edited by: Joe Zou on 2012-4-6 下午9:11

    The code looks good.
    Here is a sample based on your use-case:
    InputTextSample.jspx:
    <af:form id="f1">
            <af:panelFormLayout id="pfl1">
              <f:facet name="footer">
                <af:commandButton text="Ok" id="cb1" partialSubmit="true"
                                  actionListener="#{InputTextSampleBean.onClick}"/>
              </f:facet>
              <af:inputText label="InputText" id="it1"
                            binding="#{InputTextSampleBean.myInputText}"/>
            </af:panelFormLayout>
          </af:form>
    InputTextSampleBean.java:
    import javax.faces.event.ActionEvent;
    import oracle.adf.view.rich.component.rich.input.RichInputText;
    import oracle.adf.view.rich.context.AdfFacesContext;
    public class InputTextSampleBean {
        private RichInputText myInputText;
        public InputTextSampleBean() {
        public void setMyInputText(RichInputText myInputText) {
            this.myInputText = myInputText;
        public RichInputText getMyInputText() {
            return myInputText;
        public void onClick(ActionEvent actionEvent) {
            this.myInputText.setValue("1234");
            AdfFacesContext adfFacesContext = AdfFacesContext.getCurrentInstance();
            adfFacesContext.addPartialTarget(this.myInputText);
    }

  • How to get the current JSF phase in backing bean?

    How to get the current JSF phase in backing bean?
    Edited by: jimmy6 on Nov 27, 2007 7:27 AM

    I am using phasetracker to trace it also.I want to know whether it is it render response phase. I know FacesContext.getCurrentInstance().getRenderResponse() work for normal jsf component but it will not work for qiupukit datatable. FacesContext.getCurrentInstance().getRenderResponse() will not return true in the following phase. Why?
    [ INFO] 27-11-07 16:20:21 : BEFORE RENDER_RESPONSE(6) (http-80-Processor23)
    I want the 'get' method of datatable being called in response phase to reduce the number of calling because i put the query in 'get' method there. Actually i still straggling with the best practice to code the datatable...

  • Accessing a JSF element from a back bean method

    Hi,
    short question, can I access the JSF element from a back bean method?
    So, for example, if I have the following JSF code:
    <h:panelGroup id="test1" rendered="#{bean.someMethod}">...</h:panelGroup>
    <h:panelGroup id="test2" rendered="#{bean.someMethod}">...</h:panelGroup>
    <h:panelGroup id="test3" rendered="#{bean.someMethod}">...</h:panelGroup>
    Can I found out in some way, which element (esp. which ID) calls the someMethod-method?
    Kind regards
    Matthias

    There are more possibilities as well. If you depend it on for example the User's rights/groups, then you can also do for example:
    rendered="#{user.admin}" // getter = public boolean isAdmin()
    rendered="#{user.groupName == 'admin'}" // getter = public String getGroupName()
    rendered="#{user.groupId > 1}" // getter = public int getGroupId()
    rendered="#{fn:contains(user.groups, 'admin')}" // getter = public String[] getGroups() or public List<String> getGroups()
    etc..I think it's after all just a matter of learning about the capabilities of EL a bit more.

  • How To change the ADF View Object  query where-clause at RunTime?

    I am trying to create a simple display page which will display user data (username, assoc_dist_id, assoc_agent_id, status , etc). The User data is stored in a database table and i am using an ADF Read Only table based on the View Object to display the data on the JSF page.
    However, i want to display only the users that a particular person accessing the page has the AUTH LEVEL to see. e.g. If the person accessing the page is an 'ApplicationAdministrator' then the page should display all users in the table, If its a 'DistributorAdministrator' then the page should display only users associated with that Distributor (i.e. assoc_dist_id = :p_Dist_id ) and If its an 'AgentAdministrator' , then the page should display only users associated with that Agent ( i.e. assoc_agent_id = :p_Agent_id).
    Currently my af:table component displays all the users in the table because the query for the view object is (select * from users) . However, i want to use the same viewobject and just set the where-clause at runtime with the appropriate parameter to restrict the dataset returned.
    Do anyone knows how to accomplish this ?

    David,
    See the custom method initializeDynamicVariableDefaults() in the SRViewObjectImpl.java class in the FrameworkExtentions project in the SRDemoSampleADFBC sample application. You can find out how to install the demo if you haven't already from the ADF Learning Center at:
    http://www.oracle.com/technology/products/adf/learnadf.html
    This class is a framework extension class for view objects that adds a neat, generic feature to be able to dynamic default the value of named bind variables. You can read more about what framework extension classes are and how to use them in Chapter 25, "Advanced Business Components Techniques" of the ADF Developer's Guide for Forms/4GL Developers, also available at the learning center above.
    It is an example of generic framework functionality that "kicks in" based on the presence of custom metadata properties on a named bind variable. See section 25.3.3 "Implementing Generic Functionality Driven by Custom Properties" in the dev guide for more details. Using this sample code, if you add a bind variable to a view object, and define a custom metadata property named "DynamicDefaultValue" on that bind variable, and set this custom metadata property to the value "CurrentUser", then that bind variable will have its value dynamically defaulted to the name of the authenticated user logged in. If instead you set this custom property to the value "UserRole", then the bind variable will be set to the comma-separated string containing the list of roles that the authenticated user is part of.
    Once you've created a framework extension class for view objects like this, you can have the view objects you create inherit this generic functionality.See section 25.1.4 "How to Base an ADF Component on a Framework Extension Class" in the dev guide for more info on this.
    By adapting a technique like this (or some idea similar that better suits your needs) you can have your view object query contain bind variables whose values automatically take on the defaults based on something in the user-session environment.

Maybe you are looking for

  • Mac Office 2011 Calendar Events Moving on Exchange 2010

    Hello, I manage a domain environment that is fairly small. It has Server 2008, Outlook Exchange 2010, consisting of two domain controllers and a hand full of other Server2008 servers. All of these are virtualized on VMware ESXi and running off of a S

  • Camera not saving or sending photos ?

    The camera on my 4s will take a pic, but, will not save it or send it via Icloud.

  • Find and open files in subfolders

    Hi Simple request I know but I can't manage to find how to make fileArray = targetFolder.getFiles("*.indd"); to access *.indd files inside sub folders and perhaps in sub sub folders.. Can anyone share how to do this? Thanks in advance, Ken

  • What's the best setting for a best shades quality?

    Hi! I would like to know what are the best codec and the best setting for a video with 1920x1080 of resolution. I've tried them all but nothing because the shades...are not shades. I want a video that is like a uncompressed video but lighter. Same qu

  • Client issue with ALE Configurations

    Hi Experts, I am trying to connect to a different SAP System through ALE. I have defined logical systems. When i am trying to assign destination logical system to destination client, i am getting an error -  "Entry already exists" as there is another