Help on Multiselect list

I created a Multiselect list for item :P5_REGIONS(USING DYNAMIC )
DYNAMIC QUERY IS
SELECT DISTINCT DEPTNO FROM DEPT;
Mutiselect list
10
20
30
40
50
I have another item name :P5_SELECTED_REGIONS
So what I want to do is
When user select multi values from Multiselect list
10,20,30,40
I want to display in :P5_SELECTED_REGIONS as string '10,20,30,40'
I have another Submit button which will take the :P5_SELECTED_REGIONS values and pass to database package
Any help is appreciated

Hi,
Add the following into the regions "Region Header" setting:
<script type="text/javascript">
function showSelected(item, field)
     var sel = new Array();
     var index = 0;
     for (var intLoop = 0; intLoop < item.options.length; intLoop++)
          if (item.options(intLoop).selected)
               index = sel.length;
               sel[index] = item.options(intLoop).text;
     $f_SetValue(field, sel.join());
</script>
add the following into the HTML Form Element Attributes for the select list:
onchange="showSelected(this, 'P5_SELECTED_REGIONS');"
That should do it.
Regards
Andy

Similar Messages

  • Help with Multiselect List Item

    Assuming one employee can work for multiple departments, I want to display the departments employee 7844 works for preselected in a multiselect list.
    I am using the following query statement in a report region.
    select htmldb_item.select_list_from_query_xl(1, deptno ,'select DEPTNO,DNAME from scott.dept ','MULTIPLE HEIGHT=25', 'Y',null,null,null,'Department',null) a from scott.emp where empno = 7844
    The result I am seeing is a multiple multiselect lists with one department selected in each list.
    How should I modify the query to get what I want?
    Thanks
    Mina

    Hi Carlos,
    I set up a test case in exactly the same way and it worked fine for me. I created a page item called P1_DA_DEMO and added some static select list values then added some help text. The settings I used are below, I suggest you try again but also make sure you have no other Javascript errors on the page. Use a tool like firebug to check.
    Name : Dynamic Action Demo
    Sequence: 10
    Even: Click
    Selection type: Item(s)
    Item(s): P1_DA_DEMO <- a selection list item
    Condtion: - No Condition -
    True Actions
    Sequence: 10
    Action : Execute JavaScript Code
    Fire when event result is :True
    Fire on page load: Not Ticked
    Code: javascript:popupFieldHelp('277938589795252851','1545903379570909')
    Event Scope set a s Bind.
    Thanks
    Paul

  • Help on passing multiselect list as in values to function in database

    I am having problemn passing multiselect list as in values to function in database
    I have a static multiselect list :P1_SELECT_LIST
    10
    11
    12
    13
    14
    15
    I am passing to another item :P2_SELECTED_LIST
    ('10','11','12','13')
    I have to send :P2_SELECTED_LIST to a DATABASE PACKAGE(P_DATABASE).FUNCTION(PASS_LIST)
    P_DATABASE.PASS_LIST(P2_SELECTED_LIST)
    IN MY PASS_LIST(FUNCTION)
    function PASS_LIST(P_STRING IN VARCHAR2) IS
    type T_EMPNO is table of VARCHAR2(10) index by binary_integer;
              type T_ENAME is table of VARCHAR2(6) index by binary_integer;
              v_EMPNO T_EMPNO;
              v_ENAME T_ENAME;
    CURSOR C1 IS SELECT EMPNO,ENAME FROM EMP
    WHERE DEPTNO IN P_STRING/* ('10','11','12','13')*/;
    BEGIN
    OPEN c1(P_STRING);
    FETCH c1_axl bulk collect
    into v_EMPNO, v_ENAME limit 40000;
    CLOSE c1;
    FOR I IN 1 .. V_EMPNO.COUNT LOOP
    DBMS_OUTPUT.PUT_LINE('V_EMPNO.COUNT :'||V_EMPNO.COUNT);
    END LOOP;
    END;
    any help

    This link may help:
    Re: Date Time field
    Denes Kubicek

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

  • ApEx How 2  turn a multiselect list value (eg. 1:2:3:4 ) into (1,2,3,4)

    ApEx newbie here,
    I'm trying to get the output of a multi select list into an in list of a sql query for a report. The error message I'm getting is report error:
    ORA-01722: invalid number. (The inlist is a list of id numbers, and the data type for this column in the database is NUMBER)
    I've got a page item called P3_x which is populated from a MultiSelect list. I learned that these come out as colon delimited strings. (found a reference to hidden items in a blog that helped me figure this out)
    So I created a hidden item called P3_x_in_list which does this:
    Select '('|| regexp(:p3_x,':',',')||')' from dual which turns this into a comma separated list, like so: (1,2,3,4)
    I put this hidden item, P3_X_IN_LIST into the sql in my report region
    So in the report my sql looks like:
    select a, b, c
    from t1
    where id in: P3_x_in_list
    and some_date between :P1_X and :P2_X
    For some reason it throws an invalid number error when it runs. I haven't been able to find anything in the documentation or on the web that sheds any light on this. I'm hoping that there is a benevolent, experienced developer that can point me in the right direction. The debuging information from the page is below:
    Here is the debugging information
    0.24: ...Session State: Save "P3_X" - saving same value: "1:2:3:4:5"
    0.24: ...Session State: Save "P1_X" - saving same value: "01-DEC-2008"
    0.24: ...Session State: Save "P2_X" - saving same value: "04-DEC-2008"
    0.30: ...Session State: Save Item "P3_X_IN_LIST" newValue="(1,2,3,4,5)" "escape_on_input="N"
    0.30: Processing point: ON_SUBMIT_BEFORE_COMPUTATION
    0.46: show report
    0.46: determine column headings
    0.46: parse query as: my_schema
    1.76: binding: ":P3_X_IN_LIST"="P3_X_IN_LIST" value="(1,2,3,4,5)"
    2.64: binding: ":P2_X"="P2_X" value="04-DEC-2008"
    report error:
    ORA-01722: invalid number
    ORA-02063: preceding line from my_schema
    3.23: Computation point: AFTER_BOX_BODY
    3.23: Processing point: AFTER_BOX_BODY
    3.23: Computation point: BEFORE_FOOTER
    3.23: Processing point: BEFORE_FOOTER
    3.23: Show page tempate footer

    Well, let's say you had a SQL statement like
    select * from obj where object_id in 12345
    where object_id is defined to be a number type.
    Now, if you replace the literal '12345' with a bind variable and then bind "(1,2,3,4,5)" to this bind variable it will be clear why the SQL fails.
    As for using pipeline functions it is pretty straightforwad
    Here's an example
    CREATE OR REPLACE TYPE vc_array_1 AS TABLE OF VARCHAR2 (50);
    CREATE OR REPLACE FUNCTION get_list (
       p_string      IN   VARCHAR2,
       p_delimiter   IN   VARCHAR2 DEFAULT ':'
       RETURN vc_array_1 PIPELINED
    IS
        l_string     varchar2(32000);
        l_array     wwv_flow_global.vc_arr2;
    BEGIN
       l_array := apex_util.STRING_TO_TABLE(p_string,p_delimiter);
       for i in l_array.first..l_array.last loop
          pipe row (trim(l_array(i)));
       end loop;
       return;
    end;
    select column_value from table (get_list('1:2:3:4:5'));Your query can now be
    select a, b, c
    from t1
    where id in (select column_value from table get_list(: P3_x_in_list)) )   
    and some_date between :P1_X and :P2_XVarad

  • Delete in database based on multiselect list values

    Hi,
    I have a selectlist in Apex and a function in the database to do some delete based on the selected value from the select list.
    FUNCTION delete_batch (v_batch VARCHAR2) RETURN VARCHAR2
    IS
    BEGIN
    IF v_batch like 'M%'
    THEN
       RETURN ('A monthrun cannot be deleted');
    ELSE
       DELETE FROM so_disco_pa
       WHERE  batch = v_batch
       DELETE FROM so_batch_pa
       WHERE  batch = v_batch
       COMMIT;
       RETURN ('Batch '||v_batch||' has been deleted');
    END IF;
    EXCEPTION
    WHEN OTHERS THEN
        RETURN ('Batch could not be deleted');
    END delete_batch;The package function is called when the delete button is clicked with following process:
    BEGIN
    DECLARE
    x   varchar2(100);
    BEGIN
    x := pa_control.delete_batch (:P3_BATCH);
    :F105_MESSAGE := x;
    END;
    END;Now I want to change the selectlist to a multiselect list so that multiple batches can be deleted.
    How do I change my procedure and process to delete batches based on the selected values?
    Thanks,
    Diana

    I got this so far, but only the first batch selected in the list is being deleted. The other selected batch values are not deleted.
    Some help please.
    FUNCTION delete_batch (v_batch VARCHAR2) RETURN varchar2
    IS
    T Apex_application_global.vc_arr2;
    BEGIN
    T := apex_util.string_to_table(v_batch);
    For I in 1..t.count loop
    IF  t(i) like 'M%'
    THEN
       RETURN ('A monthrun cannot be deleted');
    ELSE
       DELETE FROM so_disco_pa
       WHERE  batch = t(i)
       DELETE FROM so_batch_pa
       WHERE  batch = t(i)
       COMMIT;
       RETURN ('Batch '||v_batch||' has been deleted');
    END IF;
    end loop;
    EXCEPTION
    WHEN OTHERS THEN
        RETURN ('Batch could not be deleted');
    END delete_batch;

  • Query Regarding multiselect list

    Hi,
    I have a multiselect list having the names of columns of one of the table say "example" table. I want to select only those columns from the "example " table which the user has chosen from the multiselect list.
    eg:
    the multiselect list has the following entries say entr1,entr2,entr3
    and my "example" table has 3 columns entr1,entr2,entr3.
    If the user selects entr1 and entr2 from the multiselect list then , I want to select only entr1 and entr2 columns from my table ie "select entr1,entr2 from example"
    I need to display those columns only in a report.
    Is there any way to do it. Any input would help.
    Regards,
    Deepthi

    You could have a dynamic query region where the column list is built using the value of the multiselect list.
    declare
    q long;
    begin
      q := 'select pk,';
      q := q || replace(:P1_MULTI_SELECT,':',',');
      q := q ||' from some_table where ....';
      return q;
    end;And choose the 'Generic columns, parse query at run-time' option under Region Definition.
    An easier option would be to write a static query with all possible columns and simply put a PL/SQL condition on each column (Report Attributes/Column Attributes) to hide it if the column name/alias is not in the multiselect's value. Something like
    instr(:P1_MULTI_SELECT,'COLUMN_NAME') > 0Hope this helps.

  • Multiselect List

    i am trying to generate a report using a multiselect list. The following SQL query for the report gives an error => 1 error has occurred
    Query cannot be parsed within the Builder. ORA-00933: SQL command not properly ended
    declare
    v_sql varchar2(32276);
    v_releases varchar2(100):=replace(:P14_TEST,':',',');
    begin
    v_sql := 'select third_party_product,base_rptno,rptno,subject
    from rpthead@v7bug';
    v_sql := v_sql||'where DO_BY_RELEASE in ('|| v_releases ||')';
    return (v_sql);
    end;
    Can anyone please help me with this. I am not too familiar with multiselect lists. Thanks.

    Kanu,
    Your returned SQL will have something like  where DO_BY_RELEASES in (a,b,c,d,e)That is incorrect syntax, which is what the error message is telling you. Even if you were to figure out a way to return:    where DO_BY_RELEASES in ('a','b','c','d','e')...which would work, that would be very, very bad as a programming practice. You need to use the more responsible technique described in: Search on a typed in list of values
    Scott

  • SAPResourceAdapter listResourceObjects multiSelect list

    Hi,
    I am customizing the SAPForm.xml for my IDM-SAP integration, I was able to show the dynamic list of activity groups and profiles, but I want to add more multiselect list like parameters and user groups. If I enter infromation on SAP interface, I already see them in my IDM interface, so it means my mapping is correct. However I cannot get a dynamic list of all available parameters and user groups like what the profiles and activitygroups are listing now. Is this availabe thru the API, or not? I tried using usergroup(s) or parameter(s) to refer to the list that I'm trying to get, but it's still empty.
    This is my field defintion for the usergroup
    <Field name='accounts[$(name)].usergroups'>
    <Display class='MultiSelect'>
    <Property name='title'>
    <concat>
         <ref>name</ref>
         <pad>
         <s>&#xA;User Groups</s>
         <i>12</i>
         </pad>
         </concat>
    </Property>
    <Property name='availableTitle' value='Available User Groups' />
    <Property name='selectedTitle' value='Selected User Groups' />
    <Property name='allowedValues'>
    <invoke name='listResourceObjects' class='com.waveset.ui.FormUtil'>
    <ref>:display.session</ref>
    <s>usergroup</s>
    <ref>name</ref>
    <map>
    <s>templateParameters</s>
    <ref>
    &#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&#x9;&#x9;&#x9;&#x9;&#x9;&#x9;accounts$(name)].templateParameters&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&#x9;&#x9;&#x9;&#x9;&#x9;
    </ref>
    </map>
    <s>true</s>
    </invoke>
    </Property>
    </Display>
    </Field>
    Hope someone helps!
    DJ

    Hello,
    Vikas has a nice example here Re: Question For Vikas: Select List Colors
    Carl

  • Create multiple Insert statements from multiselect list

    I want to thank everyone in advance for the help on this one.
    I have a multiselect list that I would like to use to create multiple Insert statements. I would like to then take those statements and execute them against the database, thus inserting the records. My thoughts are below;
    1.     Customer selects multiple items in the list
    2.     Clicks the submit button
    3.     onclick event walks through the string created by the multiselect list and creates the Insert statements by walking through an array of the values.
    4.     the Insert statements get executed against the database
    5.     page redirects to the proper page after the process is done.
    I actually have already created a javascript function that will use the split command on the string to create an array. I then get the length of the array and walk through a loop creating the sql statements. I am not sure what to do from here. How can I get the sql to execute.
    I am not wed to this approach. If there is a better idea out there please do not hesitate to share it with me. I am relatively new to APEX and have not done much work in pl/sql or javascript. But I learn fast, so don’t hold back.
    Thanks again and please let me know what questions you have for me.
    Derek.

    I setup the demo app on apex.oracle.com:
    http://apex.oracle.com/pls/apex/f?p=26255:3
    Login as demo / demo
    Go to the "products" tab. There is a Test region with a multiselect list. It shows product names (with product id's) from the demo_product_info table.
    When you select multiple things from the list and click apply, it uses the following procedure to simply insert a new record for each into the product table. It increments the product_id by 1000 and prepends "DUPLICATE " to the product_name:
    declare
    cursor c_products is
    select product_name, product_id
    from demo_product_info
    where instr(':' || :P3_X || ':', ':' || product_id || ':') >= 1
    order by 1
    begin
    for r_product in c_products loop
    insert into demo_product_info (product_id, product_name)
    values (r_product.product_id + 1000, 'DUPLICATE ' || r_product.product_name);
    end loop;
    end;
    You can see that is working by using it on the duplicate entries themselves.
    -Richard

  • Multiselect list in APEX 3.2.1.00.12

    Hello,
    I'm having troubles with a multiselect list that could potentially return a very large result set. I have a function called 'GET_LIST' that basically calls the apex_util.STRING_TO_TABLE(p_string,p_delimiter); function since the multiselect list returns a colon delimited string. If I try to select all of the values on the list I get the following message:
    Bad Request
    The request could not be understood by server due to malformed syntax.Are there any known workarounds to this issue?
    Thanks in advance!
    ~Jake

    Do any pros out there have a suggestion for this? My multiselect list has over 35,000 entries in it for certain owners. It is doubtful that anyone would ever select them all but if they should happen to they would receive an error.
    The list of values (P10_ACCTS) is simply
    select a.account_name d, a.account_id v
               from accounts a
             where a.owner = :P10_OWNERI then display a report that uses the results of the select list in the where clause:
    and (account.id in (select column_value from table (GET_LIST(nvl(:P10_ACCTS,'::'))))GET_LIST is defined as:
    CREATE OR REPLACE FUNCTION GET_LIST (
       p_string      IN   VARCHAR2,
       p_delimiter   IN   VARCHAR2 DEFAULT ':'
       RETURN vc_array_1 PIPELINED
    IS
        l_string     varchar2(32000);
        l_array     wwv_flow_global.vc_arr2;
    BEGIN
       l_array := apex_util.STRING_TO_TABLE(p_string,p_delimiter);
       for i in l_array.first..l_array.last loop
          pipe row (trim(l_array(i)));
       end loop;
       return;
    end;I believe that my limitation is the 'l_string varchar2(32000);' I need (in some cases) to be able to pass over 100,000 characters. I've tried converting GET_LIST to use a clob instead of varchar2 but have yet to be successful in implementing that approach.
    THanks in advance!
    Edited by: jhammer on Oct 15, 2010 3:13 PM

  • How to set a default value in a Value Help Drop Down List

    Hi,
    I used an age Range field in my adobe form, the control  is a Value Help Drop Down List. i am populating the drop down using following code.
    IWDAttributeInfo ageInfo = wdContext.nodePersonalData().getNodeInfo().getAttribute("CTAgeRange");
         ISimpleTypeModifiable ageType = ageInfo.getModifiableSimpleType();     
         IModifiableSimpleValueSet ageValueSet =  ageType.getSVServices().getModifiableSimpleValueSet();
         ageValueSet.put("1","21-29");
         ageValueSet.put("2","30-34");
         ageValueSet.put("3","35 or Above");
    My requirement is to set a default value e.g. 30-34 in the age range field.
    I want to give input to iform from my Implementation code only.
    Please help.
    Thanks in advance

    hi Ranjan,
    that means you have to set at design time,
    to set default drop down value you will have to set the value for particular attribute (which is linked to the dropdown element) in the context
    like
    wdContext.currentContext<nodeName>Element.set<FieldName>(<default value>)
    This generally done in Initialization method of the controller.

  • Need to create an edit Page from a Multiselect List

    I make one or more selections of values from a Multiselect List; I need to branch to another page in which I display all of the selected List items and two other columns (per item) that can be edited; i.e., this second page will look like one or more rows consisting of (1) List item, (2) value1 from a Table, (3) value2 from a Table. I need to be able to change value1 and/or value2 for any or all of the rows and have those changes reflected in the Database. (The List item is display only).
    My question is: which construction wizard can I use for this second page? I can collect my List items in a PL/SQL Table, but how can I display them and their related columns so the column values are editable?

    Thanks for the reply. I understand how to create Collections with the values I need to display and modify; however, I'm unsure which construction Wizard to employ to launch the Page ("Form based upon a Procedure", etc.)
    I looked in the Tutorials for a "collection demo" and found these potential candidates: "Build an Issue Tracking System", "Create a Simple Survey Application", and "Serving Application Express Reports". Is it one of these? If not, please tell me where I can find the "collection demo". Thanks.

  • Multiselect List and Branches

    Hi,
    1. I understand that multiselect list problem has discussed here multiple times but I could not find any answer for my situation. May be someone can give me an advise.
    I have a page that has 8 multiselect lists. A user makes his selection, presses button “Report” and gets redirected to the report page (say page A) that displays records according to the user selection. Report source on page A is PL/SQL function body returning SQL query.
    I created the button “Report” with wizard (selected option Submit Page & Redirect to URL). Everything was working fine till report was created in the same browser window. But a customer wanted to have a report displayed as a new page. So I changed ”Optional URL Redirect” target from “No Target” as it was before to URL and inserted a call to the JavaScript as URL Target ( I use this approach on several other pages).
    Now when a user presses “Report” button he is redirected to the page A but that page displays completely different set of records. It looks like multiselect lists values are not passed to the report on page A any more. What am I missing?
    2. As I mentioned before a main page has 8 multiselect lists so SQL statement is very long and I will need to create a lot of different reports based on the selections in those multiselect lists .
    Is it possible to create an Application Level Variable, pass “WHERE” part of the SQL statement into it when button “Report” is pressed ( button has setting Submit Page & Redirect to URL!) and then use it in the SQL report source to generate reports?
    Thank you in advance.
    Val

    Scott,
    Thank you for your reply.
    At the moment I switched to the URL it stopped passing multiselect list parameters( I have javascript function in the HTML Header section and call this function from the button).
    If I understand the problem correctly I do not submit page as it was before. Session window does not show any parameters.
    The only reason I need this switch - create a report in a new window.
    Val

  • How to pass multiselect list values to javascript?...

    Hi, guys...
    (continuation...)
    Here is a Q. I have two multiselect lists item on the page. I need to use the values of these items in ODP. The button calls javascript, and javascript envoke ODP. Everything is working fine if i submit the page and then call javascript, But this is extra step and it's not kind of cool...
    So i am looking for the way to pass the value of multiselect lists to javascript without submitting the page first...
    Thnks...
    Mike
    Edited by: mishkar on Oct 1, 2009 10:59 AM

    Mike:
    Try using v('page_item') instead of :page_item in the ODP code
    varad

Maybe you are looking for