Build Dynamic Query based on values of multiselect list

I am trying to implement the same functionality as shown in this app.
http://htmldb.oracle.com/pls/otn/f?p=9741:6:13406902443304236283:::::
I have hit a brick wall when I try to set the value of my text area/select statement, even after viewing the detail section in above app.
Does anybody know exactly how I can set the value of a text area from multiselect list values??

Hi Sam,
check out How to use multi select in a query report
See also Denes sample application which has and example where you can still do an index access if a index is defined for the column. http://htmldb.oracle.com/pls/otn/f?p=31517:138
Patrick
My APEX Blog: http://inside-apex.blogspot.com
The ApexLib Framework: http://apexlib.sourceforge.net
The APEX Builder Plugin: http://sourceforge.net/projects/apexplugin/

Similar Messages

  • How to build a query based on(UNION) 3 vendor InfoObject

    Dear Experts:
    I have a requirement to build one query based on 3 vendor InfoObjct: 0VENDOR + 0VEN_COMPC + 0VEN_PURORG.
    I tried to build a multiprovider upon these 3 infoobjects, but when I Identify(Assign) the key for each InfoObject, supposely there should be 3 InfoObject for me to check (0VENDOR, 0VEN_COMPC and 0VEN_PURORG) so that I can UNION these 3 infoobjects together on vendor number. But since the reference infoobject of these 3 vendor master data is different, I can not check the 3 together.
    Can anybody let me know how to build that query? I only need vendor number show once, and the attributes of 0VEN_COMPC and 0VEN_PURORG can be union to 0vENDOR.
    Any post would be appreciated and thank you all in advance!
    Best Regards!
    Tim

    Hi,
    you can create a link between the vendor objects itself, means link 0vendor with 0ven_compc and 0ven_purorg. This should give you a list of all vendors multiplied with the comp codes multiplied with the purch. org. May be here it is possible to create another link between a attribute (eg. comp_code of 0ven_purorg with comp_code of 0ven_compc). In case it is not possible you need to add this link information somehow. Another option might be to create 2 queries. One on a infoset of 0vendor and 0ven_purorg and another one on 0vendor and 0ven_compc.
    regards
    Siggi

  • Build dynamic query depending upon selection of table and columns

    Hi ,
    I want your views on following requirement :
    we r doing generic export to excel functionality .
    1.User will select multiple tables and according to tables ,columns on that table will select
    2.There can be multiple table
    3.depending upon column and table selection , we have to build dynamic query and execute .
    Please let me know is it possible .If yes then please tell me how to do above requirement.
    Thanks in advance

    Hi,
    Identifiers cannot be used as bind variables, query are parsed
    before evaluate bind variables. Identifiers like table name.
    For excel you can use some like this:
    SET MARKUP HTML ON ENTMAP ON SPOOL ON PREFORMAT OFF
    SPOOL test_xls.xls
    SELECT colum1||chr(9)||columN FROM tableName;
    or CSV:
    SELECT colum1|| ',' ||columN FROM tableName;
    SPOOL OFF
    SET MARKUP HTML OFF ENTMAP OFF SPOOL OFF PREFORMAT ON
    For construct the query i suggest to read "Dynamic SQL Statements":
    http://www.java2s.com/Tutorial/Oracle/0440__PL-SQL-Statements/0300__Dynamic-SQL.htm
    http://docs.oracle.com/cd/B28359_01/appdev.111/b28370/dynamic.htm
    http://docs.oracle.com/cd/B10500_01/appdev.920/a96590/adg09dyn.htm
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:227413938857
    --sgc                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to get the selected values from multiselected list

    Hi,
    I have a multiselect list displaying all the years from 2003 to 2008 (used dynamic LOV). The user can choose one or more years as per his needs, and then when user clicks on the link the selected values of the list are to be captured and a pop up page of a Discoveror report needs to be opened where these years get passed as a parameter. I tried several methods to capture the value, but either one or all are getting passed but not exactly what the user has chosen.
    This is how it looks:
    P2_FISCAL_YEAR is a multiselect list containing values from 2003,2004... 2008
    If user chooses 2004 and 2007
    then I want the url to capture these values and pass as parameters for my discoveror reports. as '&qp_fiscal_year=2004,2007'
    Any help is appreciated!
    Thanks in advance,
    Sapna.

    Hi,
    I have a multiselect list displaying all the years from 2003 to 2008 (used dynamic LOV). The user can choose one or more years as per his needs, and then when user clicks on the link the selected values of the list are to be captured and a pop up page of a Discoveror report needs to be opened where these years get passed as a parameter. I tried several methods to capture the value, but either one or all are getting passed but not exactly what the user has chosen.
    This is how it looks:
    P2_FISCAL_YEAR is a multiselect list containing values from 2003,2004... 2008
    If user chooses 2004 and 2007
    then I want the url to capture these values and pass as parameters for my discoveror reports. as '&qp_fiscal_year=2004,2007'
    Any help is appreciated!
    Thanks in advance,
    Sapna.

  • How to build dynamic query strings in the query using DB adapter 'Pure SQL'

    Dear Forum,
    I am building an application which will access DB to fetch some result set. The query involves retrieving data from multiple tables(nearly 10 tables). So I have created a DB adapter using 'execute pure sql' option. With this query works fine, but my inputs parameters will vary. So I need to make my query dynamic to append the query strings at runtime depending on the inputs.
    For example I have 3 input variables - input1,input2 and input3 (in my request xsd) which are used in the pure sql query. Now if I get a 4th input parameter input4 in the request, I need to append this to query string as 'AND input4=[some value]' at runtime. Otherwise my query should have only 3 parameters. Please suggest how this can be achieved.
    Regards,
    Satya.

    This is a strange requirement, depending on the columns you have and what are optional in them, one way is to have separate operations and each opeartion will have different inputs and for each operation , a different DB Adapter is called. But this way, it results in more number of operations for the service as well as more number of references in the composite. Even if you pass the column inputs to the SQL procedure, it will result in a large number of if-else cases..
    Thanks,
    N

  • Geting ORA 936 -while building dynamic query in for loop.

    HI,
    I hav written a SP and its compiled and giving me the results for the data I am quering but giving ORA936 - missing expressin and giving ORA 6512 at 2 lines. Please help me me out where I am going wrong.
    CREATE OR REPLACE TYPE LIST as VARRAY(5000) of NUMBER;
    CREATE OR REPLACE PROCEDURE test( V_id IN LIST,
    v-fdate IN DATE,
    v-tdate IN DATE,
    v_flg IN CHAR)
    AS
    TYPE opfld IS RECORD (
    FID TAB.ID%TYPE,
    FCURR TAB.CURR %TYPE,
    FCNT TAB.CNT%TYPE,
    FTOT TAB.TOT%TYPE );
    TYPE OPLIST IS REF CURSOR;
    Rc oplist;
    Edtab opfld;
    Selstr VACHAR2(200);
    Whstr1 VACHAR2(200);
    Whstr2 VACHAR2(200);
    Whstr3 VACHAR2(200);
    Whstr VACHAR2(200);
    Grpstr VACHAR2(200);
    Andstr VACHAR2(200);
    Fullstr VACHAR2(200);
    BEGIN
    Selstr := ‘SELECT col1,col2,sum(col3),sum(col4) from tab1 ’;
    Whstr1 := ‘ WHERE tdate BETWEEN TO_DATE(‘||’’’’||vfdate||’’’’||’)’;
    Whstr2: = ‘ AND TO_DATE(‘||’’’’||vtdate||’’’’||’)’;
    Whstr := whstr1||whstr2;
    Grpstr := ‘GROUP BY col1,col2’;
    IF v_flg IS NOT NULL THEN
    Whstr3 := whstr||’AND FLAG = ‘||v_flg;
    else
    Whstr3 := whstr ;
    END IF;
    FOR I IN 1..id.COUNT LOOP
    BEGIN
    Andstr := ‘ AND id =’|| v_id(i);
    Whstr := whstr3 || andstr ;
    Fullstr := selstr||whstr||grpstr;
    OPEN rc for fullstr;
    LOOP
    FETCH rc into edtab
    EXIT when rc%NOTFOUND;
    END LOOP;
    Andstr := ‘’;
    Whstr :=’’;
    END; ---BEGIN of FOR loop
    END LOOP; -- for end
    CLOSE rc;
    END; -- proc end
    Created above SP and its compiled. When I try to execute the SP with below code I am getting--
    DECLARE
    V_t LIST;
    BEGIN
    V_t:= LIST();
    V_t.EXTEND(10);
    V_t(1) := 10;
    V_t(2) := 20;
    Test(v_t,’25-APR-2012’,’30-APR-2012’,’Y’);
    END;
    The SP is building correct dynamic querry and its getting executed for id = 10 and 20, giving the correct results but though I defined only 2 ids while executing and written FOR lOOP upto ID.COUNT its building query for third time and that time its not getting id, so for the third time the last part of where clause is built like
    SELECT.....
    WHERE....
    AND id = (its taking blank here)
    GROUP BY ...;
    and thus its giving me ORA 936 missing expression and ORA 06152 at line of RECORD TYPE declaration and line of OPEN rc for fullstr;
    ERROR at line 1
    ORA 00936 misssing expresiion
    ORA 006152 at line 9
    ORA 006512 at line 87
    I hav put DBMS_OUTPUT statements @ every build of dynamic wuery and its correct. here I have not copid the code I hav typed hereso not wriiten DBMS_OUTPUT.
    I tried lot of ways redefining Andstr := ‘’;
    Whstr :=’’; after for endloop but its giving the same error. is this because I am using varray? If am providing 2 ids in anonymous block then how its building query for third blank ID value.
    Please help me out here..
    Thanks a lot..

    >
    I hav written a SP and its compiled and giving me the results for the data I am quering
    >
    Then you should have posted the one that compiles and gives you results.
    The code you posted will not compile without errors. Edit your original post and provide the corrected code.
    When you do please add \ tags on the line before and after the code to preserve formatting. See the FAQ for details.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Dynamic Action based on Interactive Report Select List Value

    I'd like to perform a Dynamic Action when a user selects one of 3 options from a Select List within an Interactive Report:
    select APEX_ITEM.SELECT_LIST(
    p_idx => 3,
    --p_value         =>   deptno,
    p_list_values => 'Copy;Copy,Delete;Delete,Export to PDF;Export to PDF',
    --p_attributes    =>   'style="color:red;"',
    p_show_null => 'YES',
    p_null_value => NULL,
    p_null_text => '--Select--',
    --p_item_id       =>   'f03_#ROWNUM#',
    p_item_id => 'P6_IR_SELECT_LIST',
    p_item_label => 'Label for f03_#ROWNUM#',
    p_show_extra => 'YES') "Actions"
    from dual;
    When building the Dynamic Action, I chose the following values from the Advanced wizard
    Event: Select
    Selection Type: DOM Object
    DOM Object: P6_IR_SELECT_LIST
    Condition: Equal to
    Value: "Delete"
    True Action: Execute Javascript Code: Alert('Here');
    Doesn't seem to be firing...can anyone help?
    Thanks in advance,
    John

    Hi,
    I am not sure if the "equal to" condition applies to a DOM object... after all, a DOM object can be anything (any HTML element) not only a field.
    Try using a javascript expression instead, like this:
    $v('P6_IR_SELECT_LIST')=='Delete'UPDATE: Sorry, I just tested and "equal to" condition works for DOM objects... should have tested before posting!
    Luis
    Edited by: Luis Cabral on Feb 29, 2012 4:45 PM

  • Query based on values in a csv

    Got a CSV file with about 11,000 entries, trying to query database based on those entries.
    Was thinking something along these lines:
    select * from table where value in (column 1 in csv file)
    Not sure how to do this, anyone know?

    Hi,
    Create an [external table|http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_7002.htm#sthref7332].
    You can then query the csv file as if it were a table.

  • Dynamic query getting incorrect values due to version restriction

    Hi,
    I'm using query designer version 6.40, Support Package 16, we currently can't update this due to other problems.
    In one of my queries I have a dynamic row structure. The static column structure has three columns and is restricted on actual, forecast and budget version variables. In the default values I have 0CS_VERSION restricted to a generic version variable, say v0.
    However, when I run the query, v0 overwrites all the other version variables. If I remove v0 I get the error message shown below. I have tried to combine removing v0 and the consolidation group default values but that doesn't work either. I've moved v0 into the free characteristics and I have attempted to set it to all of the other versions, this also results in the error below. I've checked through SAP notes and the forum and haven't found anything, any help would be appreciated.
    "Version not specified or not unique"
    Diagnosis
    You need to specify the version in the report to enable the system to determine the consolidation units each consolidation group consists of. The version must be specified per cell and must be unique per cell. This is not the case in this report.
    One of the following conditions exist:
    No version was specified.
    The specified version no longer exists.
    The version is not unique.
    System Response
    Processing terminated
    Procedure
    Enter the version for each cell in a unique way.
    Procedure for System Administration

    One of our in-house guys has found the solution. The problem was that there were values in the default values which were superfluous. For example: in the default values we had fiscal year = fiscal year variable, in the column structure we set the fiscal year variable to an offset of -1. Once we'd removed all of the extra default values the version was no longer a problem and the query ran correctly taking in all the different versions required.
    Regards.

  • Dynamic messageChoice based on value in each row

    Hi All,
    Am trying to implement a requirment, am not sure how i can acchive this in OAF.
    I would appriciate any one who points me in the right direction
    How to have a dynamic messageChoice in OAFTable.
    My scenario is like this,
         OAFTable[UI Table]
    ========================================
    | Name | xxx      | MessageChoice values |
    ========================================
    | 12-A | xxx | Apple,Airport |
    | 15-B | xxx | Ball,Box |
    | 20-S | xxx | Singapore |
    =======================================|
    VALUE_TABLE[DB table]
    =======================
    | Letter | Value |
    =======================
    | A     | Apple |
    | S     | Singapore |
    | A     | Airport |
    | B | Ball |
    | B | Box |
    =======================
    There is a messageChoice column in my OAFTable(third column as represented above),
    values for this messageChoice should be filtered on 'Name' column in each row i.e extract the letter and use this extracted value to filter the values in VALUE_TABLE.
    Where clause for each rows message choice should dynamically modify as
    Row 1 : select value from VALUE_TABLE where letter = 'A'
    Row 2 : select value from VALUE_TABLE where letter = 'B'
    Row 3 : select value from VALUE_TABLE where letter = 'C'
    since messageChoice EVENT is generated only after value is changed, i cann use that to modify the where clause of the VO.
    Is there any feature in OAF that modifyes VO's WHERE clause for each row?
    what will be the ideal approach to acchive this. surely some one would have resolved this kind of scenario..
    Advance thanks for any suggestions :)
    srinath

    Hi,
    Yes there is a standard approach available
    Consider a container, such as a table, that has two columns. One column displays a department, while the
    other column displays all the employees of that department in a poplist. The view object used for the poplist
    (Pick List View Definition) needs the department number (the "Deptno" field of the container) bound for bind
    variable :1. This can be done with the following code example in the controller's processRequest method:
    OATableBean table = ...
    OAMessageChoiceBean empPoplist =
    (OAMessageChoiceBean)table.findChildRecursive("EmpName");
    empPoplist.setListVOBoundContainerColumn(0, /* bind index */
    table,"Deptno");
    This code binds the first (0th) bind index of the employee poplist view object to the value displayed by the
    column named Deptno in the table.
    The method setListVOBoundContainerColumn can be called multiple times if the query used for the poplist has
    multiple bind variables. Note that this approach effectively simulates a BC4J view link except that it relies on
    the UI table columns for the bind values rather than the view object attribute values directly.
    Thanks,
    Gaurav

  • Dynamic query based Simple Choice List not working as expected.

    I've a value in a View Object attribute which is not present in the LOV associated to it. How to show this in the UI if the attribute's component is a Simple Choice List ?

    Jdev Version is : 11.1.1.6.0
    The attribute for which the LOV exists has a value which was once active on an earlier date, i.e, the LOV used to show the value in it's dropdown on an earlier date.
    Example:
    The ViewObject query for the LOV is:
    SELECT JOB_ID, END_DATE FROM JOBS WHERE END_DATE > SYSDATE
    Results
    JOB_ID -- END_DATE
    45 -- -- -- 23-OCT-2012
    56 -- -- -- 21-OCT-2012
    76 -- -- -- 15-NOV-2012
    78 -- -- -- 15-DEC-2012
    Now,
    The main viewObject EmployeesVO has an attribute JOB_ID with an LOV to the JOBS VO above.
    On 20th Oct, 2012, when I create an employee record, the LOV shows all 4 records in JOBS dropdown and I selected job Id as 56.
    On 25th Oct, when I try to edit the Employee Record, I see a blank item in the JOBS choice list (the LOV being a simple choice list).
    The LOV will display the jobs which are active as on 25th Oct.
    How do I know, what is the current job of the employee?
    This issue will not happen if we use input list of values combo LOV

  • Problem in getting selected values from multiselect list

    Hi,
    I have two multiselect listboxes in my page. In List1 the data will be retrieved from DB and listed.I will have buttons to move the values from List1 to List2 and viceversa.
    After selecting the needed values,I can rearrange them in List2 using some buttons. I have coded this moving and reordering using javascript.
    What happens is while submitting the page I want the values from list2 which are rearranged. But im getting the order in which I moved from list1 to list2.
    I am using html:selectfor both lists
    List1
    <html:select name="CustForm" property="custName" multiple="true" size="10">
           <html optionsCollection property="CustomerNames" value="custName" label="id"/>
    </html:select>I am having a customer form which has a arraylist CustomerNames. This arraylist has customer bean which has proeprties custName and id. The custForm also has a String custName.
    List2
    <html:select name="CustForm" property="selectedCustName" multiple="true" size="10">
           <html  option value=""/>
    </html:select> The custForm also has a String[] selectedCustNames from where I get the selected values in list2
    Please let me know what am I doing wrong here.

    use a treeSelectionListener, that will give you all the selection changes you need.
    thomas

  • How do I get value of MultiSelect List in javascript?

    Hi,
    If I want to show the colon delimited list in a JS alert box what would I do?
    or how else do you show it?
    Is there multiple SelectedIndexes?
    type = select-multiple
    Bill

    Bill,
    have a closer look at the example I provided earlierly:
    http://apex.oracle.com/pls/otn/f?p=31517:166
    I am using this code:
    for (i = 0; i &lt; $x(pShuttle2).length; i++)
         if (p_array == '')
    p_array = $x(pShuttle2).value;
         else
    p_array = p_array + ':' + $x(pShuttle2)[i].value;
    get.add('SHUTTLE_ITEM_VALUE', p_array);
    to concatenate the array values into a colon delimited string. This is later used to set the session state of the shuttle item to that value.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1

  • To build dynamic SQL Query using some conditions: Pseudo code required

    Hi,
    I have a requirement where in i have to build a dynamic query based on one count.
    Some details on requirement:
    1) It's a Proc where i need to return some columns
    2) There are some fix set of columns
    3) Based on one Count column, i have to decide the rest of the columns.
    Consider there is an employee who can work on 'N' number of assignments.
    For a particular employee i have to return all the predefined details of assignments like:
    1) Assignment Name
    2) Assignmanet Id
    3) Assignemnt Start Date
    4) Assignment End Date
    This 'N' can vary from employee to employee. Based on which i have to return my result set. For instance if employee has 3 assignemnts, i have to return Fix columns( employee info) + (3*4) columns. Similarly if the employee has 4 assignments, i will be returning Fix columns + (4*4) columns.
    Certainly, the Employee ID is coming as an I/P parameter.
    The source table is a vertical table having all details of the employee assignments.
    Can anyone help me in coding this proc with the help of some pseudo code?

    Do you mean you need something like this to be executed dynamically for some known n := max(count(assignment_id))
    NOT TESTED !
    select e.dept_id,e.emp_id,e.epm_name,
           substr(x1,1,instr(x1,';',1,1) - 1) assignment_name_1,
           to_number(substr(x1,instr(x1,';',1,1) + 1,instr(x1,';',1,2) - instr(x1,';',1,1) - 1))) assignment_id_1,
           to_date(substr(x1,instr(x1,';',1,1) + 1,instr(x1,';',1,3) - instr(x1,';',1,2) - 1)),'yyyymmdd') assignment_start_date_1,
           to_date(substr(x1,instr(x1,';',1,1) + 1,instr(x1,';',1,3) + 1)),'yyyymmdd') assignment_end_date_1,
           substr(x2,1,instr(x2,';',1,1) - 1) assignment_name_2,
           to_number(substr(x2,instr(x2,';',1,1) + 1,instr(x2,';',1,2) - instr(x2,';',1,1) - 1))) assignment_id_2,
           to_date(substr(x2,instr(x2,';',1,1) + 1,instr(x2,';',1,3) - instr(x2,';',1,2) - 1)),'yyyymmdd') assignment_start_date_2,
           to_date(substr(x2,instr(x2,';',1,1) + 1,instr(x2,';',1,3) + 1)),'yyyymmdd') assignment_end_date_2,
           substr(xn,1,instr(xn,';',1,1) - 1) assignment_name_n,
           to_number(substr(xn,instr(xn,';',1,1) + 1,instr(xn,';',1,2) - instr(xn,';',1,1) - 1))) assignment_id_n,
           to_date(substr(xn,instr(xn,';',1,1) + 1,instr(xn,';',1,3) - instr(xn,';',1,2) - 1)),'yyyymmdd') assignment_start_date_n,
           to_date(substr(xn,instr(xn,';',1,1) + 1,instr(xn,';',1,3) + 1)),'yyyymmdd') assignment_end_date_n
      from (select e.dept_id,e.emp_id,e.epm_name,
                   max(decode(rnk,1,x)) x1,
                   max(decode(rnk,1,x)) x2,
                   max(decode(rnk,1,x)) xn
              from (select e.dept_id,e.emp_id,e.epm_name,
                           a.assignment_name||';'||to_char(a.assignment_id)||';'||
                           to_char(a.assignment_start_date,'yyyymmdd')||';'||to_char(a.assignment_end_date,'yyyymmdd') x,
                           dense_rank() over (partition by e.dept_id,e.emp_id,e.epm_name order by a.assignment_id) rnk
                      from employees e,assignments a
                     where e.emp_id = a.emp_id
             group by e.dept_id,e.emp_id,e.epm_name
           )Regards
    Etbin

  • Create a dynamic query with or/and

    Hello!
    Please help to accomplish the following:
    User needs to create a dynamic query.
    There are few select lists: sex, race, state …
    User selects whatever he needs from select lists, which would become the first part of the “where clause” – i.e. (sex = ‘M’ AND state = ‘NY’).
    Then the user wants to add an additional condition using “OR/AND” – i.e. i.e. (sex = ‘M’ AND state = ‘NY’) OR (sex = ‘F’).
    I have been able to build the first clause and pass to a variable. I need to be able to clear the values in the select lists, but keep the value stored in the variable, and then append each new clause to the variable. This needs to be event driven by an item on the page.
    Any help is appreciated.
    Thank you in advance.

    Hi,
    At that point my application works fine.
    But I need to add ability to clear select lists and enter a new condition with 'OR'
    operator.
    The final SQL statement should look:
    select employee_id, name from employee_v where (sex = ‘M’ AND state = ‘NY’) OR (sex = ‘F’)
    Thank you.

Maybe you are looking for