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

Similar Messages

  • URGEN: How to programmatically assign bind variables in View Object

    Hi,
    I have a method action in my pagedef
    <methodAction id="SetBindAttributeValueToQuotationsView"
                      InstanceName="QuotationsEBAppModuleDataControl.dataProvider"
                      DataControl="QuotationsEBAppModuleDataControl"
                      MethodName="SetBindAttributeValueToQuotationsView"
                      RequiresUpdateModel="true"
                      Action="999" IsViewObjectMethod="false">
          <NamedData NDName="quotTransNo"
                     NDValue="${bindings.SetBindAttributeValueToQuotationsView_quotTransNo}"
                     NDType="java.lang.Integer" NDOption="2"/>
        </methodAction>Im going to assign values to the bind variables and use the method action in my pagedef.
    Thanks.

    hi
    u check ur view name & page def binds value,
    both of them should be same
    thanks

  • How to populate transient attribute from view object dynamically

    I have three 4 tables named as "employee,event,event_progress,and checklist progress". i have created a view object using the first three tables . i ahave also created 5 transient variables in to the same view object.when i dragged the view object in to my page as a table i want to populate those transient attribute.
    i have 5 transient attribute which are present as a column value named as chechlist_name in another table "checklist".those all transient attribute also having two sub rows whose data should be populated from the checklist progress table.

    Hi
    Please post your question on this forum, your question belong to this forum.
    JDeveloper and ADF
    Muhammad Nasir

  • How to use bind parameter in view object

    in my view object has parameter as below
    where :organization_id IS NULL
    :organization_id parameter get value from LOV
    I can run the page but it show following error :
    oracle.apps.fnd.framework.OAException: oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation. Statement: SELECT * FROM (SELECT hou.name organization_name
    ,hapf.name position_name
    ,hapf.attribute1 position_fund
    ,pg.name grade_name
    ,pbd.budget_detail_id
    ,hapf.position_id
    ,pbd.budget_version_id pbd_budget_version_id
    ,pbv.budget_version_id pbv_budget_version_id
    ,'Y' VIEW_DETAIL
    ,'Y' VIEW_DETAIL_OCC
    ,greatest(hapf.effective_start_date, pbv.date_from) effective_date
    FROM pqh_budget_details pbd
    ,hr_all_positions_f hapf
    ,hr_all_organization_units hou
    ,per_grades pg
    ,pqh_budget_versions pbv
    WHERE pbd.budget_version_id = pbv.budget_version_id
    AND pbd.position_id = hapf.position_id
    AND hapf.effective_end_date = hr_general.end_of_time
    AND hou.organization_id = hapf.organization_id
    AND pg.grade_id = hapf.entry_grade_id
    AND EXISTS (
    SELECT 'X'
    FROM hr_all_positions_f hapf1
    WHERE hapf1.position_id = hapf.position_id
    AND hapf1.availability_status_id = 1
    AND (pbv.date_from BETWEEN hapf1.effective_Start_date AND hapf1.effective_end_date
                        OR
                   hapf1.effective_Start_date BETWEEN pbv.date_from AND pbv.date_to))
    and :gl_organization = 10)
    ## Detail 0 ##
    java.sql.SQLException: ORA-01008: not all variables bound
    Thank you very much

    Is it a seeded view or a custom view? Ideally, in OAF you do parameter binding in the style
    organization_id = :1
    Also make sure to call setWhereClauseParams(null) on your view object before going for binding.
    --Shiv                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

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

  • Setting bind variables in view objects for LOV

    ADF 11.1.1.1.0
    I have two application modules - amCodeTable (contains the code tables) and amLOV (contains the list of values)
    In amLOV I have a VO aListOfValuesVo (not based on an entity) that runs a query Select * from aTable where userNr = :pBindVar
    In amCodeTable I have a VO aMainTableVo based on an EO, This VO has a field (aLOVField) which has a LOV defined on it and uses the
    aListOfValuesVo.
    I've hardcoded the bind parameter to its corresponding value and everything works as expected, list of values from
    aListOfValuesVo available on the aLOVField in aMainTableVo.
    I now need to set the bind parameter by code.
    What I have tried to do is override the execute query of the aListOfValuesVo in the aListOfValuesVoImpl.java
        @Override
        public void executeQuery() {
           setNamedWhereClauseParam("pBindVar","32");
           super.executeQuery();       
        }If I test the amLOV application module the query returns the correct values.
    If I test the amCodeTable the list of values on the aLOVField in the view aMainTableVo is empty.
    I've added a breakpoint to the executeQuery() method but it would seem that the method is not called.
    How are bind parameters for list of values set ?
    Paul

    Ok I've activated an SQL trace and got the following :
    [498] _LOCAL_VIEW_USAGE_ch_mit_trac_model_views_codeTables_SttIncotermView_lovUserBranch_0 ViewRowSetImpl.doSetWhereClause(-1, pUserNr, null)
    [499] _LOCAL_VIEW_USAGE_ch_mit_trac_model_views_codeTables_SttIncotermView_lovUserBranch_0 ViewRowSetImpl.execute caused params to be "un"changed
    [500] Column count: 4
    [501] _LOCAL_VIEW_USAGE_ch_mit_trac_model_views_codeTables_SttIncotermView_lovUserBranch_0 ViewRowSetImpl.doSetWhereClause(-1, pUserNr, null)
    [502] _LOCAL_VIEW_USAGE_ch_mit_trac_model_views_codeTables_SttIncotermView_lovUserBranch ViewRowSetImpl.setNamedWhereClauseParam(pUserNr, 41)
    [503] ViewObject: _LOCAL_VIEW_USAGE_ch_mit_trac_model_views_codeTables_SttIncotermView_lovUserBranch Created new QUERY statement
    [504] _LOCAL_VIEW_USAGE_ch_mit_trac_model_views_codeTables_SttIncotermView_lovUserBranch>#q computed SQLStmtBufLen: 238, actual=198, storing=228
    [505] Select b.Branch_Nr,Decode(b.status,1,'','*')||b.Branch_Id DisplayId,b.Designation,b.Status
    from stt_branch b, stt_users_branch u
    where u.user_nr = :pUserNr
    and b.Branch_Nr = u.Branch_nr
    order by 4,1
    [506] Bind params for ViewObject: _LOCAL_VIEW_USAGE_ch_mit_trac_model_views_codeTables_SttIncotermView_lovUserBranch
    [507] For RowSet : _LOCAL_VIEW_USAGE_ch_mit_trac_model_views_codeTables_SttIncotermView_lovUserBranch_0
    [508] Binding null of type 12 for "pUserNr"To me this looks as if 2 lovUserBranch instances have been created a lovUserBranch and a lovUserBranch_0
    The parameter is being binded to the lovUserBranch but the LOV is using the lovUserBranch_0 which has a bind value of null
    Anybody got any idea as to what is happening ?
    Regards
    Paul

  • Dynamically change the Binding of a view object

    I want to reuse a panel several times in my application. The VO has one bind parameter (:1). The same panel should be reused several times with different bind variables.
    I found a technical note concerning this issue called: How to Dynamically Change the binding of a View Object to a JClient Panel. This works for JDeveloper 9i but not for JDeveloper 19g. Does anybody know how to dynamically change the binding in JDeveloper 10g

    You may use bindRowSetIterator() and pass in a custom fetched ViewObject or a RowSetIterator to the iterator binding that is displayed in your panel.

  • How to construct a new complete view object programmatically

    HI,
    I want to construct a new complete view object programmatically. I have a result set based on the rows returned from this query i need to build the new vo and show it n a form. Please tell me the complete procedure to do this or else provide me any links.
    Thanks
    Satya

    Hi,
    have a look how dynamic tables are created (using af:forEach to iterate the attribute Defs for generating columns). Your approach is similar except that you not only need to know about attributes but also the rows to fecth
    1. create a tree binding for the view object
    2. create the binding with one hierarchy
    3. ensure all attributes are deleted for the tree binding (you do this manually in the PageDef)
    4. when executing the query for a new SQL, call clearForRecreate() on the DCIteratorBinding instance
    5. On the page, use af:forEach to create the form fields and labels for each row. Like for dynamic tables, you first need to determine the attributes to render (its a nested loop you are going for
    6. Updates of the form fields must be through a managed bean
    Frank

  • Error when Setting value to Bind variable in View Link used in HGrid

    Hi
    I have requirement to pass profile id as bind variable, I have created a VO based on below Query.
    select 'N' Is_Selected, 'N' Is_Already_Selected, 'N' Is_Selected_Copy, a.*
    from XXPA_STATE_CONST_DTLS_V a, xxpa_state_const_dtls b
    where a.child_id = b.child_id(+)
    and b.profile_id(+) = :1
    View Link Query that is being generated is
    SELECT * FROM (select 'N' Is_Selected, 'N' Is_Already_Selected, 'N' Is_Selected_Copy, a.*
    from XXPA_STATE_CONST_DTLS_V a, xxpa_state_const_dtls b
    where a.child_id = b.child_id(+)
    and b.profile_id(+) = :1) QRSLT WHERE PARENT_ID = :Bind_ChildId
    it Shows Errors as
    ## Detail 0 ##
    java.sql.SQLException: Missing IN or OUT parameter at index:: 1
    could anyone tell what could be the wrong. Do we need to set bind variable in view link Explicitly? or any other alternative.
    Its very Urgent.
    Regards
    Vimal

    Hi,
    I have faced similar problem some time ago. I could not find any solution except removing bind parameters in where clause. I tried to change binding style but it also didn't work. I think the problem is caused by view link's where clause.

  • How to use bind variables in the following query

    CREATE OR REPLACE PROCEDURE MMDB.test IS
    sel_qtn VARCHAR2 (10);
    CURSOR PT_QUANTITY IS select * from mmdb.product_tree WHERE QUANTITY_CHECK ='E'
    AND run_id = 100
    a PT_QUANTITY%ROWTYPE;
    BEGIN
    FOR i IN PT_QUANTITY
    loop
    sel_qtn := i.quanttity-1;
    While sel_qtn>=1
    loop
    insert into mmdb.product_tree (BILLING_ACCOUNT_NO ,S_CODE) values (i.BILLING_ACCOUNT_NO ,i.S_CODE||'E');
    sel_qtn :=sel_qtn -1;
    End loop;
    commit;
    end;

    Don't duplicate threads: How to use bind variables in the following query

  • How to use bind variables in this procedure

    Hi Experts,
    How to use bind variables in this procedure for static queries.
    PROCEDURE DELETE_MER_PROC (M_id IN NUMBER)
    IS
    BEGIN
    V_date DATE;
    SELECT PD_DATE INTO v_date FROM PD_MAINTAIN;
        DELETE FROM MER_CLEAR
        WHERE MER_DT < v_date
        AND ID = M_ID;
    COMMIT;
    END;   
    How to use  v_date and m_id as bind variables in this procedure to avoid hard parsing.
    Please help me.
    Thanks.

    976208 wrote:
    How to use  v_date and m_id as bind variables in this procedure to avoid hard parsing.
    You cannot avoid hard parsing - as the 1st time a SQL statement (like the SELECT or DELETE statements in your code) is encountered, it does not reside in the server's Shared Pool, and needs to be added into the pool via a hard parse.
    Bind variables does not prevent hard parsing. Hard parsing happens when the SQL statement (with or without bind variables) is a brand new statement encountered by the server.
    Bind variables enables the same SQL cursor to be reused, by simply changing the bind variable value.
    Not using bind variables means that each SQL statement is unique and not shareable - as the value is hardcoded into the statement and cannot be changed via a bind value. This typically means LOTS of different SQL statements (where the only difference is the changed value in the statement) are created - with each statement being a new statement not seen before in the Shared Pool and needing to be hard parsed.
    One does not design one's code not to be hard parsed. There ALWAYS will be a hard parse in order to get a SQL statement into the Shared Pool. One designs one's code to REUSE cursors in the Shared Pool.

  • How to use Bind Variables in Essbase data control

    Hi,
    I am trying to use Bind Variables in MDX query while creating the Essbase Data Control. I have used the below query with the Bind Variable.. this query is working in Essbase admin console..but it is throwing error (*Invalid MDX Query)* while creating Essbase Datacontrol in JDeveloper.
    MDX Query : SELECT {[Measures].Msr_2} ON COLUMNS, [Time].Children ON ROWS FROM cube
    where ($name)
    Could any body suggest me on how to use bind variables with Essbase Data control.
    Thanks,
    Swathi

    Hello Swathi, can you please help me how you created Essbase DataControl? Also were you able to figure out this?
    Thanks, Praveen.

  • How to enter bind variables in Calender SQL statement

    Hi,
    Anyone know how to include bind variables in Calender SQL statement. Let's say in sql statement below:
    select
    EMP.HIREDATE the_date,
    EMP.ENAME the_name,
    null the_name_link,
    null the_date_link,
    null the_target
    from SCOTT.EMP
    order by EMP.HIREDATE
    thanks.

    Hi,
    Here is the sql statement
    select
    EMP.HIREDATE the_date,
    EMP.ENAME the_name,
    null the_name_link,
    null the_date_link,
    null the_target
    from SCOTT.EMP
    where deptno = :dept
    order by EMP.HIREDATE
    Thanks,
    Sharmila

  • How to use bind variable

    Hi,
    I have the below cursor 1 which is working already.For my requirement i want to use bind variable like second cursor.But its telling Bind Variable "p_col_list" is NOT DECLARED.Please any onehelp me on this.
    How to use bind variable Here.
    Cursor1:
    DECLARE
    emp_cv sys_refcursor;
    iid NUMBER := 1;
    i_sql varchar2(100);
    p_col_list varchar2(2000) := 'aaa,bbb,ccc,ddd';
    BEGIN
    i_sql := 'select '''||REPLACE(p_col_list, ',', ''',''')||''' from dual '||CHR(10) ;
    dbms_output.put_line(i_sql);
    OPEN emp_cv FOR i_sql ;
    END;
    Cursor2:
    DECLARE
    emp_cv sys_refcursor;
    iid NUMBER := 1;
    i_sql varchar2(100);
    p_col_list varchar2(2000) := 'aaa,bbb,ccc,ddd';
    BEGIN
    i_sql := 'select '''||REPLACE(:p_col_list, ',', ''',''')||''' from dual '||CHR(10) ;
    dbms_output.put_line(i_sql);
    OPEN emp_cv FOR i_sql using p_col_list;
    END;

    hello,
    the reports parameterform capabilities are limited. if you want
    to create sophisticated parameterforms, you should do that with
    oracle forms or html forms.
    regards,
    the oracle reports team --pw                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Bind variables in views

    I am having some performance issues using bind variables in views (Oracle 7.3.4). When I execute the view using '' values the view executes the expected execution plan. When I execute the view using bind variables the execution plan changes to something undesireable. I believe this to be a static execution plan in the case of using bind variables. I have updated all tables referenced by the view and compiled the view; but, the execution plan when using the bind variables does not change. Can you give me some advice on finding out why the execution plan in the case of using bind variables does not change based on the new set of statistics and being re-compiled.

    even if you use a literal isn't that automatically
    changed into a bind variable during at compile time?That would be the case when your have CURSOR_SHARING = FORCE. The default should be EXACT.
    SQL> show parameter cursor_sharing
    NAME                                 TYPE        VALUE
    cursor_sharing                       string      EXACT
    SQL>Actually, since you have the constants in the view, and if everyone uses the view, they share the same shared cursor (since the constants are never changing across each use).
    If you supplement the view with additional WHERE conditions (when using the view):
    SELECT <columns> FROM your_view WHERE <additional_conditions> ;
    Ten you might want to look into using bind variables for values used in such additional conditions.

Maybe you are looking for

  • How user OID (or other ldap) users with JAAS in my JEE application?

    Hy people, I'm developing a JEE application and for secuity I'm using JAAS, but I would like use users from my OID to authenticate. Is it possible? Can someone help me? Thanks!!! Regards,

  • Satellite 2800-500 DVD doesn't play video DVD-ROM SD-R2002

    My DVD doesn't play videos . CD rom works fine. but when I put DVD it makes a sound as if it would play , the drive's light would stay on but the DVD would not play. I live in Europe and the regional settings is at 2 which is ok.The DVDs play on anot

  • Videos now Musik, help me

    Hi There When I last connected my Ipod Video (30GB) to my computer and opend the iTunes, it automatically started a "Optimization for the songs, so they play faster" or something like that. After that ALL my Videos on the iPod were treated like music

  • Source file is ZIP file

    hi all, in a simple scenario , source file is in the form of ZIP folder how can i pickup this file by using FCC. thanks. vijay

  • How to see which files are open on shares

    Im fairly new to OS X Server. Am running OS X Server 10.6.8 How can i see files that are open through AFP or SMB? I've tried the command lsof but that doesnt seem to show open files through network.