ADF where-clause variables binding.

Hi guys,
I'm implementing a programmatic view object which will use data from a non-db data source.
I'm trying to identify the filtering mechanism that this VO uses when I create a filterable table in the UI which is backed by this object.
As much as I have figured out, ADF will create some where-clause bind variables whose names are vc_temp1, vc_temp2 and set the values of these variables to what I entered into the filtering text box.
The information I can't seem to figure out is the binding between the view object attributes and the bind variables, therefore I cannot map the attributes to the correct filtering values.
For example, a for a view object with two attributes: name and address.
If I filter on the name column, the query from getQuery would look like this:
SELECT .... FROM .... WHERE name LIKE (:vc_temp1 || %)
Similarly, if only the address column is filtered:
SELECT .... FROM .... WHERE address LIKE (:vc_temp1 || %)
If both are filtered:
SELECT .... FROM .... WHERE name LIKE (:vc_temp1 || %) AND address LIKE (:vc_temp2 || %)
I was able to get the mapping between the bind variables (vc_temp1, vc_temp2) and their corresponding value, but not the mapping, for example in the third case, between vc_temp1 and name (or vc_temp2 and address). Is there any way to achieve this?
Thanks.

Hi Lovin_JV_941794,
Sorry but I don't get your solution.
The binding variables vc_temp1, vc_temp2 are added to the query automatically by ADF and only when I try filtering the table data. Basically I cannot control this creation, if I have 10 columns in my tables and only filter 1 column, then the binding variable being created is vc_temp1. If I filter on all 10 columns, then 10 binding variables vc_temp<1 to 10> will be inserted into the query where-clause.
I am able to get the values of these variables, but not the info about which attributes (columns) they are mapped to. For example,
SELECT .... FROM .... WHERE name LIKE (:vc_temp1 || %)
I cannot get the info that vc_temp1 is bound to the attribute "name". I'm looking for a way to achieve this so I can programmatically do the filtering with my non-db data source.
Thanks.

Similar Messages

  • Where clause with Bind Variable in ViewObject

    As per recomendations from Jdev team they say that using Bind varialbles in where clause will improve the performance (Option 1) But it is causing us to create more view objects.
    Example : Lets say we have a View Object EmpVO
    Option 1:
    ViewObject vo=context.getViewObject("EmpVO");
    vo.setWhereClause("EMPNO=?");
    vo.setWhereClauseParam(0,st);
    (or)
    Option 2:
    vo.setWhereClause("EMPNO="+st);
    If we want to use same View Object "EmpVO" in another Action Class
    ViewObject vo1=context.getViewObject("EmpVO");
    vo1.setWhereClause("DEPTNO=?");
    vo1.setWhereClauseParam(0,str);
    It this case it throws an error saying BIND VARIABLE already exits. So we have to make another View Object.
    Where as if we did not use bind variable but used Option 2 approach the same view object can be used in multiple pages.(at the expense of performance as per Jdev team)
    Are we doing something wrong here or are there other ways to use the same view object when using bind variable in where clause.
    Thanks

    I haven't been using BC4J for a while, but I seem to recall that the recommendations are that you don't set the where clause at runtime: You're supposed to define your view with the bind parameter already in it.
    So you'd probably define an EmpsForEmpNoVO and type "EMPNO = ?" in the where box. (There are other ways of finding a single row/entity and one of those may well be more efficient. Perhaps a better example of where you might want a view of employees is WHERE DEPTNO = ?.)
    IIRC, all instances of a particular type of view share the same definition, so you have to be careful if you alter that at runtime. However, I think everything's set up so that you can have many different (and separate) resultsets for a single view (instance) - meaning that it's possible to "run" a view for (e.g.) two different ids. (It's definitely possible to create two different instances of a view from its definition - and the resultsets will definitely be separate then. I think there's a "create" method on the application module; I remember that "find..." always returns the same instance of the view.)
    Hope that's a push in the right direction (since no-one else had replied - and I hope not too much has changed since 9.0.3)....
    Mike.

  • Using bind variable in dynamic where clause and concatenate with query

    Hi,
    In my procedure i am framing where clause dynamically with bind variable,When i am concatenate this with my sql query for REF CURSOR i got sql command not properly ended exception.
    Is it possible to pass values to the bind variable through the dynamic variable/value?
    Please advise
    Thanks in advance
    Siva
    IF in_applicationId IS NOT NULL THEN
              optional_where := optional_where || ' AND a.APPLICATION_ID like '||':e%';
              optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'||',in_queue_id'||',in_applicationId';
         END IF;
    My query is like this
    open Out_Main FOR SelectQuery USING optional_using

    Thanks for reply,
    In my procedure, i suppose to frame the where clause with bind dynamically according to the input parameters. so that i am framing the values of the bind variables also dynamically like this,
    Please advise...
    IF in_assignedAppFlag IS NOT NULL THEN
              IF in_assignedAppFlag = 'Y' THEN
                   optional_where := optional_where || ' AND b.ASSIGNED_TO = :b' ;
              optional_using := ' in_appFuncGroup'||',in_currentUserID';          
              ELSe
                   IF in_isSupervisor = 0 THEN
                        optional_where := optional_where || ' AND (b.ASSIGNED_TO = :b'||' OR b.ASSIGNED_TO = ''-1'' OR b.ASSIGNED_TO IS NULL)';
              optional_using := ' in_appFuncGroup'||',in_currentUserID';
                   END IF;
              END IF;
         ELSE
              IF in_isSupervisor = 0 THEN
                   optional_where := optional_where || ' AND (b.ASSIGNED_TO = :b'||' OR b.ASSIGNED_TO = ''-1'' OR b.ASSIGNED_TO IS NULL)';
                   optional_using := ' in_appFuncGroup'||',in_currentUserID';
              END IF;
         END IF;
         IF in_appFuncGroup IS NOT NULL THEN
              optional_where := optional_where || ' AND e.APP_FUNC_GROUP= :c';
              optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup';
         END IF;
         IF in_queue_id IS NOT NULL THEN
              optional_where := optional_where || ' AND b.QUEUE_ID = :d';
              optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'||',in_queue_id';
         END IF;
         IF in_applicationId IS NOT NULL THEN
              optional_where := optional_where || ' AND a.APPLICATION_ID like '||':e%';
              optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'||',in_queue_id'||',in_applicationId';
         END IF;
         IF in_sourceCode IS NOT NULL THEN
              optional_where := optional_where || ' AND e.APP_SOURCE_CODE like '||':f%';
              optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'
              ||',in_queue_id'||',in_applicationId'||',in_sourceCode';
         END IF;
         IF in_logo IS NOT NULL THEN
              optional_where := optional_where || ' AND appProds.PRODUCT_TYPE like '||':g%';
              optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'
              ||',in_queue_id'||',in_applicationId'||',in_sourceCode'||',in_logo';
         END IF;
         IF in_firstName IS NOT NULL THEN
              optional_where := optional_where || ' AND upper(a.FIRST_NAME) like upper(:h%)';
              optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'
              ||',in_queue_id'||',in_applicationId'||',in_sourceCode'||',in_logo'||',in_firstName';
         END IF;
         IF in_surName IS NOT NULL THEN
              optional_where := optional_where || ' AND upper(a.SURNAME) like upper(:i%)';
              optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'
              ||',in_queue_id'||',in_applicationId'||',in_sourceCode'||',in_logo'||',in_firstName'||',in_surName';
         END IF;
         IF in_retreival_id IS NOT NULL THEN
              optional_where := optional_where || ' AND e.RETREIVAL_ID like :j%';
              optional_using := ' in_appFuncGroup'||',in_currentUserID'||',in_appFuncGroup'
              ||',in_queue_id'||',in_applicationId'||',in_sourceCode'||',in_logo'||',in_firstName'||',in_surName'||',in_retreival_id';
         END IF;

  • ADF Groovy Expression with bind variable and ResourceBundle

    Now I have ViewObject which have WHERE clause with bind variable.
    This bind variable is for language. Within bind variable I can change Value Type to Expression and into Value: I put +(ResourceBundle.getBundle("model.ModelBundle")).getString("language")+.
    Now if I run Oracle Business Component Browser (on AppModule) this works. In my ModelBundle.properties there is language=1 name-value pair. And with different locale I have different language number.
    Now if I put that ViewObject on one JSF, this bind variable expression does not work any more. Error:
    *oracle.jbo.JboException: JBO-29000: Unexpected exception caught: java.util.MissingResourceException, msg=Can't find bundle for base name model.ModelBundle, locale my_locale*
    Any ideas?
    10x
    Zmeda

    The most wierd thing is that, if I make ViewObjectImpl and insert this method
    public String getLanguage() {
    return (ResourceBundle.getBundle("model.ModelBundle")).getString("language");
    and call it in Bind Variable Expression Value: viewObject.getLanguage()
    IT WORKS!
    But why with groovy expression it does not work?
    Zmeda

  • SQL IN clause with Bind parameter?

    Hi
    I have a simple task that hasn't been so simple to figure out. I want to allow a user to search for one or more comma-separated values in a simple JClient ADF app. Is there a way to use a SQL IN clause with a single bind variable? e.g. SELECT TITLE FROM CITATION WHERE ID IN (:0)
    When I pass a single value it works fine but a comma separated list doesn't.
    Thanks
    John

    Update: I wanted to combine the techniques found in two of Steve Muench's articles -
    1) Providing Default Values for View Object Bind Variables (so I could display an ADF-bound JPanel with defaults)
    http://radio.weblogs.com/0118231/stories/2004/10/07/providingDefaultValuesForViewObjectBindVariables.html
    2) Array of String Domain Example (so a user could enter one or more comma-separated values into a text box for DB searches)
    http://radio.weblogs.com/0118231/stories/2004/09/23/notYetDocumentedAdfSampleApplications.html
    I learned some helpful stuff about the framework but spent lots of time banging my head against the wall because the two examples wouldn't work when directly combined. To best understand this, be sure to study Steve's examples above.
    In example 1 Steve passes an array of objects (Object[] DEFAULT_VALUES) to the ViewObject's where clause using the setWhereClauseParams(Object[] values). However, in example 2 he creates an Oracle Array which contains an Oracle ArrayDescriptor, Connection, and array of values to pass to the "IN" bind variable. Also, example 1 allows for multiple bind vars to be included whereas example 2 allows for an array of data to be passed to a single bind var. Even though my code provides an array to a single bind var (per ex. 2) it should still allow for the passage of multiple bind vars with minimal code modification.
    Code from Steve's example 1 was copied into my EmpView ViewObject but certain modifications were necessary:
    1) Change the ViewObject's DEFAULT_VALUES from Object[] to String[].
    2) Modify the executeQueryForCollection() method in the ViewObject to call a function which will set the bind variables as Oracle Arrays (effectively converting the "params" data type from that of String[] to Oracle Array[])
    3) Create a setManagerID(String[]) method in the EmpView object and expose it to the client.
    (there are a number of others so it's best for you to go through the code and compare)
    I finally got it working so I'm attaching the code, however beware - I'm new to this so there may be other, better ways to go about it. Also, there are no framework bind vars so that section of code is never executed...it compiles but may fail at run time.
    In order for this to work I suggest you use JDev to re-create the EmpView and Panel1 objects. This will ensure that the necessary ADF framework components are generated. Once complete, then copy in the code provided.
    *File: EmpViewImpl.java
    *Created as Read-Only access view object with the
    *query:
    *select manager_id, last_name from hr.employees
    *where manager_id IN
    *(select * from TABLE(CAST(:0 as TABLE_OF_VARCHAR)))
    *order by manager_id
    package model;
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.SQLException;
    import oracle.jbo.domain.Array;
    import oracle.jbo.server.ViewObjectImpl;
    import oracle.sql.ArrayDescriptor;
    // --- File generated by Oracle ADF Business Components Design Time.
    // --- Custom code may be added to this class.
    // --- Warning: Do not modify method signatures of generated methods.
    public class EmpViewImpl extends ViewObjectImpl implements model.common.EmpView
    private ArrayDescriptor descriptor;
    private final static String[] DEFAULT_VALUES_STRING = new String[]{"100"};
    private final static int NUM_DEFAULT_VALUES = DEFAULT_VALUES_STRING.length;
    * This is the default constructor (do not remove)
    public EmpViewImpl()
    protected void executeQueryForCollection (Object qc, Object[] params, int numUserParams)
    Object pars[] = null;
    // Bind default variables only if none have been provided by the user
    if (numUserParams == 0)
    numUserParams = NUM_DEFAULT_VALUES;
    int numFwkSuppliedBindVals = (params != null) ? params.length : 0;
    if (numFwkSuppliedBindVals > 0)
    // Allocate a new Object[] array with enough room for both user- and framework-supplied vars
    Object[] newBinds = new Object[numFwkSuppliedBindVals + numUserParams];
    // Copy the framework-supplied bind variables into a new Object[] array
    // leaving enough slots at the beginning for the user-supplied vars
    System.arraycopy(params, 0, newBinds, numUserParams, numFwkSuppliedBindVals);
    // Now copy in the user-supplied vars to the beginning of the array
    System.arraycopy(DEFAULT_VALUES_STRING, 0, newBinds, 0, numUserParams);
    params = newBinds;
    } else
    params = DEFAULT_VALUES_STRING;
    // We have to call this method to convert the default values into the proper Oracle Array expected by the query.
    // If you set a debugger breakpoint at this line you can see that the "params" data type changes from String[] to Object[]
    setWhereClauseParamsToDefaultValues();
    // Now retrieve the params of the new data type
    params = this.getWhereClauseParams();
    super.executeQueryForCollection(qc, params, numUserParams);
    private void setWhereClauseParamsToDefaultValues()
    this.setManagerID(DEFAULT_VALUES_STRING);
    private Connection getCurrentConnection() throws SQLException
    // Create a bogus statement so that we can access our current connection
    // JBD note - Does this get run each time??
    PreparedStatement st = getDBTransaction().createPreparedStatement("commit", 1);
    Connection conn = st.getConnection();
    st.close();
    return conn;
    private synchronized void setupDescriptor(Connection conn) throws SQLException
    descriptor = new ArrayDescriptor("TABLE_OF_VARCHAR", conn);
    * setManagerID
    * Exposed to client to accept an array of values (presumably passed in by user-entry into text box
    * @param aryMan
    public void setManagerID(String[] aryMan)
    Array arr = null;
    try
    // Find the connection
    Connection conn = getCurrentConnection();
    //Create the ArrayDescriptor by looking for our custom data type in our connected DB
    if(descriptor == null)
    setupDescriptor(conn);
    // Create the Oracle Array by passing in the descriptor, connection, and object array of data
    arr = new Array(descriptor, conn, aryMan);
    } catch (SQLException se)
    System.out.println("SQL Exception: " + se.getMessage());
    // Now we can set the WHERE clause parameter bind variable (index = 0) to the Oracle Array
    if (arr != null) setWhereClauseParam(0, arr);
    * FILE: Panel1.java
    * Created as an empty panel. Then a JTextField, a
    * JButton, and an EmpView1 table were dragged on.
    * A custom actionPerformed method was created for the
    * JButton which grabs the data from the text box.
    * The user can enter either a single manager id or
    * multiple, comma-separated ids.
    * All code in this class was created by JDev except
    * for the Jbutton action
    package view;
    import java.awt.*;
    import javax.swing.*;
    import model.common.*;
    import oracle.jbo.ApplicationModule;
    import oracle.jbo.SQLStmtException;
    import oracle.jbo.uicli.jui.*;
    import oracle.jbo.uicli.controls.*;
    import oracle.jbo.uicli.binding.*;
    import oracle.jdeveloper.layout.*;
    import oracle.adf.model.*;
    import oracle.adf.model.binding.*;
    import java.util.ArrayList;
    import oracle.jdeveloper.layout.VerticalFlowLayout;
    import javax.swing.JTextField;
    import javax.swing.JButton;
    import javax.swing.JTable;
    import javax.swing.table.TableModel;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    public class Panel1 extends JPanel implements JUPanel
    * NOTE: You need to have previous created the Oracle8 type named
    * ==== TABLE_OF_VARCHAR by doing the following at the SQL*Plus
    * command prompt:
    * create type table_of_varchar as table of varchar2(20)
    // Panel binding definition used by design time
    private JUPanelBinding panelBinding = new JUPanelBinding("Panel1UIModel");
    private VerticalFlowLayout verticalFlowLayout1 = new VerticalFlowLayout();
    private JTextField jTextField1 = new JTextField();
    private JButton jButton1 = new JButton();
    private JTable jTable1 = new JTable();
    * The default constructor for panel
    public Panel1()
    * the JbInit method
    public void jbInit() throws Exception
    this.setLayout(verticalFlowLayout1);
    jTextField1.setText("jTextField1");
    jButton1.setText("jButton1");
    jButton1.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent e)
    jButton1_actionPerformed(e);
    this.add(jTextField1, null);
    this.add(jButton1, null);
    this.add(jTable1, null);
    jTable1.setModel((TableModel)panelBinding.bindUIControl("EmpView1", jTable1));
    public static void main(String [] args)
    try
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    catch(Exception exemp)
    exemp.printStackTrace();
    Panel1 panel = new Panel1();
    panel.setBindingContext(JUTestFrame.startTestFrame("DataBindings.cpx", "null", panel, panel.getPanelBinding(), new Dimension(400, 300)));
    panel.revalidate();
    * JUPanel implementation
    public JUPanelBinding getPanelBinding()
    return panelBinding;
    private void unRegisterProjectGlobalVariables(BindingContext bindCtx)
    JUUtil.unRegisterNavigationBarInterface(panelBinding, bindCtx);
    private void registerProjectGlobalVariables(BindingContext bindCtx)
    JUUtil.registerNavigationBarInterface(panelBinding, bindCtx);
    public void setBindingContext(BindingContext bindCtx)
    if (panelBinding.getPanel() == null)
    panelBinding = panelBinding.setup(bindCtx, this);
    registerProjectGlobalVariables(bindCtx);
    panelBinding.refreshControl();
    try
    jbInit();
    panelBinding.refreshControl();
    catch(Exception ex)
    panelBinding.reportException(ex);
    private void jButton1_actionPerformed(ActionEvent e)
    // Get the user-supplied values
    String txt = jTextField1.getText();
    String[] mIds = txt.split(",");
    // Now trim
    for (int i=0; i<mIds.length; i++)
    mIds[i] = mIds.trim();
    ApplicationModule am = (ApplicationModule)panelBinding.getDataControl().getDataProvider();
    EmpView vo = (EmpView)am.findViewObject("EmpView1");
    vo.setManagerID(mIds);
    try
    vo.executeQuery();
    } catch (SQLStmtException s)
    System.out.println("Query failed: " + s.getMessage());

  • How to populate bind variable in view objects where clause in ADF faces

    I've got a page with 2 input items.
    The user manually enters the first value.
    On the second input item I have created a LOV for the item which opens in a popup. How do I restrict the data returned in the LOV using the value entered in the first input item. I have created a bind variable and have included it in the where clause for the view object but how do I populated it.

    Here is an example:
    Using the HR schema with the EMPLOYEES and DEPARTMENTS tables.
    Example is using ADF BC and created an EMPLOYEES entity with an updateable view object for page,
    and created a DEPARTMENTS view as a lookup
    (SQL: select department_id, department_name from departments where department_name = :DeptName)
    1: add method to the backing bean to filter the LOV
    public void getTextValueToFilterLOV(ValueChangeEvent valueChangeEvent) {
    Object value_from_form = valueChangeEvent.getNewValue();
    FacesContext fctx = FacesContext.getCurrentInstance();
    Application fapp = fctx.getApplication();
    JUFormBinding formBinding = (JUFormBinding)fapp.createValueBinding("#{bindings}").getValue(fctx);
    DCIteratorBinding dcBinding = (DCIteratorBinding)formBinding.get("DeptLOVIterator");
    ViewObject vo = dcBinding.getViewObject();
    vo.setNamedWhereClauseParam("DeptName",value_from_form);
    vo.executeQuery();
    2. add valueChangeListener to the inputText on the page with an id and autoSubmit="true"
    <af:inputText value="#{bindings.LastName.inputValue}" label="#{bindings.LastName.label}" binding="#{backing_DeptForm.inputText3}"
    id="inputText3"
    autoSubmit="true"
    valueChangeListener="#{backing_DeptForm.getTextValueToFilterLOV}">
    </af:inputText>
    3. reference the LOV with the id name on the partialTriggers property
    <af:selectOneChoice value="#{bindings.EmployeesUpdView1DepartmentId.inputValue}"
    label="#{bindings.EmployeesUpdView1DepartmentId.label}" binding="#{backing_DeptForm.selectOneChoice1}"
    id="selectOneChoice1"
    partialTriggers="inputText3">
    <f:selectItems value="#{bindings.EmployeesUpdView1DepartmentId.items}"
    binding="#{backing_DeptForm.selectItems1}"
    id="selectItems1"/>
    </af:selectOneChoice>
    Summary:
    When you entered a text (LastName), that value is passed into the backing bean method.
    The Bean method code will find the LOV Iterator and put the value into the bind variable.
    Cheers,
    Jim

  • [Solved] Named Bind Variables at Runtime - SQL WHERE clause issue

    Hey 'all,
    I've been having this issue today with a Search page using Named Bind Variables at Runtime for the search parameters for the WHERE clause in the view objects SQL.
    I've got everything working except for a clearing method which I've created so that the user can clear the current WHERE clause from the SQL statment and set it as 1=2 (so that it doesn't do a blind query on load).
    The method can clear and set the WHERE clause to 1=2 only when there is already one there.
    Below are the methods: (located in my view object class)
    public void findInvoiceById(Number invoiceId){
        setWhereClause("invoice_id = :P_INVOICE_ID");
        defineNamedWhereClauseParam("P_INVOICE_ID",null,null);
        setNamedWhereClauseParam("P_INVOICE_ID",invoiceId);
        executeQuery();
    public void clearCriteria(){
        setWhereClause("1=2");
        removeNamedWhereClauseParam("P_INVOICE_ID");
        executeQuery();
    }The error which I get is the following - this happens when the button is pressed twice in a row, or when no query has been passed previously.
    1. JBO-29000: Unexpected exception caught: oracle.jbo.NoDefException, msg=JBO-25058: Definition P_INVOICE_ID of type Variable not found in SupplierInvoicesView1
    2. JBO-25058: Definition P_INVOICE_ID of type Variable not found in SupplierInvoicesView1
    Any help with this would be greatly appreciated!
    Cheers,

    Hi Bonnie,
    we have it working ok, but still feel that there is room for improvement in the design.
    For us the key factors are:
    Pages based on the same view object that can be queried multiple ways.
    We don't want to put design time bind variables in because it limits the use of the VO
    We don't wan't multiple VO's with different where clauses.
    The page is displaying the same table columns and fields, but the where clause must be dynamic.
    We only want to query on the search field entered (some of our tables are massive)
    TopLink named queries are really what we are after, but we don't want to forgo all the other ADF BC functionality. The only examples of ViewCriteria in the developer guide had literals in the where clause and no bind variables. The View Criteria may still be an option, but it appeared quite complex compaired to directly adding and removing bind variables at runtime.
    a couple of footnotes:
    the following methods are used to clear the runtime variables prior to reusing the VO (thanks to John Stegman for the pointer on the exception handler):
        public void clearBindVariable(String bindVariableName){
            try
                removeNamedWhereClauseParam(bindVariableName);
            catch (NoDefException e)
        public void clearBindVariables(){
            clearBindVariable("P_INVOICE_ID");
            clearBindVariable("P_INVOICE_NUM");
            clearBindVariable("P_SUPPLIER_NAME");
            clearBindVariable("P_INVOICE_DATE_FROM");
            clearBindVariable("P_INVOICE_DATE_TO");
            clearBindVariable("P_SUPPLIER_NUMBER");
        }We are using 1=1 and 1=2 in the where clause to supress blind querying. 1=2 is applied when ever we are not explicitely searching for something. We had a problem with using the refresh condition ${adfFacesContext.postback == true} which I posted about here:
    executeQuery called twice using ${adfFacesContext.postback == true}
    Would still gladly hear other ideas on a better reuse design.
    regards,
    Brenden

  • How to bind a VO :variable in a WHERE clause to a page parameter

    Hello,
    I have a VO. This VO has a variable :v in the WHERE clause of the query.
    This VO is used by different UI components in a page (a table, a tree). The page already has a parameter defined in his properties #{viewScope.myparam}
    What I want is to bind :v to the #{viewScope.myparam}, so that I can specify :v from a parameter in the URL, so that the table immeditaly shows the proper results.
    Is there a way to Bind :v to #{viewScope.myparam} directly in the VO definition in the model project? (It seems it is not possilble)
    The other alternative is to use ExecuteWithParams, but in this case I do not know how to perform the query without user actions in a trasparent way. I dont want to associate execute operations to UI components.
    thanks

    Hi,
    +Is there a way to Bind :v to #{viewScope.myparam} directly in the VO definition in the model project? (It seems it is not possilble)+
    No, this can't be done
    The other alternative is to use ExecuteWithParams, but in this case I do not know how to perform the query without user actions in a trasparent way. I dont want to associate execute operations to UI components.
    If you are within a bounded task flow or in an unbounded task flow that does not have this page as its first view (home page) then you can drag and drop executeWithParams as a method call activity. The attribute then should be saved in the pageFlowScope (not the viewScope).
    In addition I would use a ViewCriteria instead of "hard wiring" the bind variable to the VO definition. You can then - in the AM data model section - associate the View Criteria with the VO instance yo use in the UI
    Frank

  • Bind variable as where clause

    hello,
    we want to build an dynamic sql IR. so when a user logs into our application we have an page process that fills an application item :F_ITEM_WHERE with part of the where clause from an IR. On the page with the IR we have as region source something similiar to:
    SELECT test_api_per_cus.get_per_name(id_per_cus) as Customer,
    test_api_per_cus.get_per_cus_nr(id_per_cus) as "Cus.-Nr",
    vtr_nr AS "VS-Nr."
    id_vtr,
    id_per_cus
    FROM test_vtr
    WHERE test_vtr.id_grp = :F_ID_GRP
    AND test_vtr.id_per_cus IN
    *(SELECT id_per_cus*
    FROM viva_per_cus
    WHERE LEVEL BETWEEN test_api_per_emo_r_tree.get_per_emp_r_tree_from(:F_ID_PER_EMP,
    *:F_ID_GRP) AND*
    test_api_per_emp_r_tree.get_per_mit_r_tree_to(:F_ID_PER_EMP,
    *:F_ID_GRP)*
    START WITH per_cus_nr =
    test_api_per_emp_r_tree.get_per_emp_r_tree_tree(:F_ID_PER_EMP,
    *:F_ID_GRP)*
    CONNECT BY PRIOR per_cus_nr = per_cus_number
    AND PRIOR id_grp = :F_ID_GRP)
    AND EXISTS
    so we want outsourcing the marked part of the where clause into :F_ITEM_WHERE. The result is as following:
    SELECT test_api_per_cus.get_per_name(id_per_cus) as Customer,
    test_api_per_cus.get_per_cus_nr(id_per_cus) as "Cus.-Nr",
    vtr_nr AS "VS-Nr."
    id_vtr,
    id_per_cus
    FROM test_vtr
    WHERE test_vtr.id_grp = :F_ID_GRP
    AND test_vtr.id_per_cus IN *|| :F_ITEM_WHERE ||*
    AND EXISTS
    Here says Apex that the Query cannot be parsed...if we fill the item plus 'AND test_vtr.id_per_cus IN' so our statement looks like this:
    SELECT test_api_per_cus.get_per_name(id_per_cus) as Customer,
    test_api_per_cus.get_per_cus_nr(id_per_cus) as "Cus.-Nr",
    vtr_nr AS "VS-Nr."
    id_vtr,
    id_per_cus
    FROM test_vtr
    WHERE test_vtr.id_grp = :F_ID_GRP
    *:F_ITEM_WHERE*
    AND EXISTS
    the query can parse but after that running apex says: bind :F_ITEM_WHERE not possible
    Anyone got an solution for this? I think it´s only a syntax thing or something...
    Thanks Daniel
    Edited by: user12086353 on 14.09.2010 06:01

    When posting code on the forum, put {noformat}{noformat} (with the curly brackets and the word code in lowercase) above and below your code like this...
    {noformat}{noformat}
    SELECT *
    FROM emp
    {noformat}{noformat}
    It will then appear like this, preserving formatting...SELECT *
    FROM emp
    Please post your code, properly formatted of +exactly+ what you have put in the region source. I'm not convinced that you need dynamic SQL at all.
    Cheers
    Ben                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

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

  • Setting bind values in where clause in ViewObjectImpl

    We want customize our views in a special manner. To look up for instance a text in the session langauge, we add a bind variable to the declared where clause of a VO:
    and text.lang = :lang
    Let's suppose, the actual value of the session language be known within ViewObjectImplementations. I want to set the bind value transparently within the ViewObjectImplementation rather than having to do it in every UI related client using this VO. Until now, I set the bind value whenever getViewObject or BuildWhereClause is called. This is sufficient for the AM Tester, but not for JClient forms using this VO (as a Not-all-values-bound exception is thrown), and I am not able to figure out by the documentation which methods of a VO are called when it is created and queried by a JClient form.

    See this web log posting on providing automatic default values for VO bind variables:
    http://radio.weblogs.com/0118231/2003/08/01.html#a127

  • ADF - ViewObject (with Bind Variable) Bind to Table- JDeveloper 10.1.3 EA

    Hi all,
    1.- This is the situation:
    In JDeveloper 10g 10.1.3 EA I have two JSP JSF Pages with bind automatically coponents (backing bean).
    - In the first page I can select a value from a list. Then, when I press the "Accept" ADF Command Button, the selected value is stored in a property called "rutEntidad" of a Session Managed Bean and the Flow Control is passed to the second page.
    - In the second page I have an ADF Table (called tablePolizas) bind to a ViewObject (I drop the ViewObject from the Data Control Palette to the Page - ADF Read-Only Table ). The ViewObject has a Bind Variable called RUT_ENTIDAD. When this page is loaded, value in the rutEntidad property of Session Managed Bean is passed to the ViewObject in order the ADF Table show filtered data . Also in this page there is a "back" ADF Command Button to the first page. The filter mechanism is performed in the getTablePolizas method in the backing bean of the second page, like this:
    //**** The backing bean of the second page *****
    package cl.bicevida.view.backing;
    public class CrearUsuario {
    private CoreTable tablePolizas;
    public CoreTable getTablePolizas() {
    DCBindingContainer dcbc;
    DCControlBinding cb;
    String rutEntidad;
    FacesContext ctx =FacesContext.getCurrentInstance();
    ValueBinding vb =
    ctx.getApplication().createValueBinding("#{SessionManager.rutEntidad}");
    rutEntidad = vb.getValue(ctx).toString();
    dcbc = this.getBindingContainer();
    cb = dcbc.findCtrlBinding("VoPolizasAsociadasEntidadExterna1");
    ViewObject vo = cb.getViewObject();
    vo.setNamedWhereClauseParam("RUT_ENTIDAD", rutEntidad);
    vo.executeQuery();
    return tablePolizas;
    2.- And this is the problem:
    The first time all works fine... then I press the "back" ADF Command Button to the first page (and NOT the back button of the browser). The second time, if the numbers of rows returned by the ViewObject is different than the first time, the application throws this message (but not crash):
    validation - JBO-29000: Unexpected exception caught: oracle.jbo.JboException, msg=JBO-35007: Row currency has changed since the user interface was rendered. The expected row key was oracle.jbo.Key[1 ]
    validation - JBO-35007: Row currency has changed since the user interface was rendered. The expected row key was oracle.jbo.Key[1 ]
    Well, I had read the "Generic Approach for Back-Button-Friendly Web Rowset Paging" article of Steve Muench in http://www.oracle.com/technology/products/jdev/tips/muench/paging/index.html
    but I think here have another problem.
    3.- The questions:
    Which is the cause of this problem?
    How I can solve it?
    What another way I can programmatic pass a parameter to a ViewObject connected to a table?
    Thanks!!!

    Another thing: the used strategy to obtain a binding container is explained by Steve Muench http://www.oracle.com/technology/products/jdev/tips/muench/1013eabinding/index.html:
    Next, you can use JDeveloper's Overview tab of the faces-config.xml file editor to configure a managed property. Define the managed property name as bindingContainer to match the property in your bean, and set the class to the fully-qualified name of the DCBindingContainer class. You can use the (Browse...) button to quickly locate the class using the new JDeveloper 10.1.3 class browser. Just type in the first few letters of the DCBindingContainer name, and then select the class. Edit the new managed property and set its Value to the JSF EL expression: #{bindings}.
    ************************

  • ADF BC View Objects: Disappearing where clauses

    Playing around with the 11g Technical Preview I find out that sometimes the where clauses - added to View Objects by means of the new "Join Type" field in the VO-editor UI - disappear.
    I'm not able to reproduce exactly and "on demand", but it seems to happen when the sources of more than one View Object are open simultaneously and/or the XML definition of a View Object is edited directly on the Source-tab.

    Today I succeeded in reproducing:
    Two tables:
    TAB_MASTER:
    ID NUMBER NOT NULL
    DESCRIPTION VARCHAR2 NOT NULL
    TAB_DETAIL:
    ID NUMBER NOT NULL
    MASTER_ID NUMBER NOT NULL
    DESCRIPTION VARCHAR2 NOT NULL
    TAB_DETAIL.MASTER_ID is a foreign key referencing TAB_MASTER.ID.
    Steps to reproduce:
    1. Generate default ADF BC objects from database tables.
    2. Open definition of TAB_DETAIL View Object.
    3. Go to the Entity Objects tab
    4. Add TAB_MASTER Entity Object to the Selected Entities Objects. Association and Join Type are filled in automatically.
    5. Go to the Query tab and go to SQL tab in de Property Inspector. Where clause is filled.
    6. Go to the Attributes tab and click Add from Entity...
    7. Add TAB_MASTER.DESCRIPTION attribute.
    8. Again, go to the Query tab and go to SQL tab in de Property Inspector. Where clause is still filled.
    9. Go to the Attributes tab and select MASTER_ID attribute.
    10. Click icon to add List Of Values
    11. In List Of Values dialog add View Object TAB_MASTER and add the correct pairs of List Return Values for the ID and (MASTER) DESCRIPTION attributes.
    12. After completing the List Of Values dialog go to the Query tab -> SQL tab again. The where clause added to join the Entity Objects (see step 5.) is cleared, resulting in a wrong SQL statement for the View Object.

  • How can we use  form variable in where clause while personalization

    Dear,
    I have a requirment for using select in personalization, actully we have created temporary table, now we want to get data from select satatement on event"when-new-record-instance' trigger, now in action tab i have selected action which is property and message, in message column showing value "${item.q_res.transaction_id.value}" it shows on validate button but when this form variable use in action type(property) which is consist on select statement "=SELECT to_char(QTY) FROM TEST_TABLE where transaction_id = ${item.q_res.transaction_id.value}" system didn't get value pressing validate button although there is a single record in customize table while without where cluase was getting data perfectly.
    please advice.

    >
    I am looking for to decode the actual db value something in different for my report.
    like if A then Accepted
    elseif R then Rejected
    elseif D then Denied
    these conditions I have to check in where clause.
    >
    what are you trying to do?
    may be you are looking for
    select * from tab1,tab2
    where a.tab1 = b.tab2
    and
       (decode(:code, 'A','Accepted') = <table_column>
        or
        decode(:code, 'R','Rejected') = <table_column>
       or
        decode(:code, 'D','Denied') = <table_column>
       )

  • How to use a lexical variable in a WHERE clause and as a function argument.

    Hello,
    My report has a lexical variable which has values like 'and id in (1,3,4)'. I want to use this variable in two separate queries. In the first, it is used in the WHERE clause, something like:
    .. where date is not null &var;
    In the second query, the variable is used in a function call, something like:
    select * from table (my_function(&var));
    The trouble is that the first query works when the value of the variable is unquoted, but for the second query the value should be quoted.
    Does anyone have an idea how I could solve this problem?
    Thanks in advance,
    Frans
    Message was edited by:
    fransie

    http://tkyte.blogspot.com/2006/06/varying-in-lists.html
    Presents many options.

Maybe you are looking for

  • ICal not sending to iCloud after Lion update.

    Just upgraded iMac to Lion 10.7.3 and now iCal not sending new appointments or reminders to iCloud. However in the opposite direction, if I create on iOS on iPhone/iPad then these are sent on to iCloud and then pushed down to iCal fine. Turning iClou

  • Can't download the latest update for iTunes

    Hi, I tried to download the sofware update for itunes 10.6.3 for my MacBook Pro, but as soon as the download begins, it stops and I get an error message saying: "The update 'iTunes' can't be installed", and also "The update could not be verified..."

  • Constant GPU panics with a twist

    Hello all I have been having a difficult issue that it seems apple has trouble fixing and so has everyone Ive talked to as well.  After upgrading to Maverick from snow leopard I have started get GPU panics at a rate of 1 or 2 a week when I had none b

  • Casting List to Array of Unknown SubClass

    How do I cast a java.util.List to an array of a unknown subclass of a known parent class? Parent[] parents = someMethod(); // someMethod returns ChildA[] or ChildB[] both extends Parent and are unknown to this method List list = new Vector(); for (in

  • How to programmatically read the SequenceFile currently open (front most) ?

    I have open in TS few sequences, they can be sequences or subsequences, but the one is currently open in TS. I would like to know from the ActiveX libs the one sequence file that is front most in teststand. I know I can enumerate on all open sequence