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

Similar Messages

  • How to display struts form list values?

    HI,
    How to display struts form list values?
    I am having master and child data.
    I can set list values master and child in action class.
    How to display the master and child data in struts jsp form.
    <logic:iterate id="result" name="listofEmployees" >
    <td ><bean:write name="result" property="id"/></td>
    <td ><bean:write name="result" property="name"/></td>
    <td > <bean:write name="result" property="list"/>  </td>
    </tr>
    </logic:iterate>Here I am displaying master data succesfully.
    How to iterate values of <td ><bean:write name="result" property="list"/></td>in action class i added bean class to this list.
    how to iterate this list with java bean and display my child data
    Thanks
    sai

    Struts 1 or 2?
    I guess 2 'cause you're just talking about Action, without mentioning the Form.
    In STRUTS 1 it goes like this: forward to the page and use logic:iterate tag. Don't know about STRUTS 2, but It shouldn't be too different.
    bye.

  • 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

  • How to get multiselect list values

    I have a multiselect list set up called :P_Staff_ID which uses a LOV (select staff_name, staff_id from staff)
    to display staff names to the screen.
    What function can i use to get all the selected names in the list for my submit process?
    Thanks
    Ray

    Ray,
    The selected values will be returned as a colon delimited list, e.g.: 20:30:40:50
    You can use the htmldb_util.string_to_table function to convert it to something a more suitable for inserting. This is the spec of the function from the documentation:
    HTMLDB_UTIL.STRING_TO_TABLE (
    p_string IN VARCHAR2,
    p_separator IN VARCHAR2 DEFAULT ':')
    RETURN HTMLDB_APPLICATION_GLOBAL.VC_ARR2;
    and a sample that loops over the values:
    DECLARE
    l_vc_arr2 HTMLDB_APPLICATION_GLOBAL.VC_ARR2;
    BEGIN
    l_vc_arr2 := HTMLDB_UTIL.STRING_TO_TABLE('One:Two:Three');
    FOR z IN 1..l_vc_arr2.count LOOP
         htp.p(l_vc_arr2(z));
    END LOOP;
    END;
    Sergio

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

  • How to modify drop down list values of a screen field in UDM_DISPUTE?

    Hi All,
    I have a requirement wherein i need to modify the drop down list for a screen field depending on the value of the other screen field in transaction UDM_DISPUTE. 
    Please suggest how this can be achived.
    Any BADI 's or any other approach is available?
    Thanks in advance,
    Srilakshmi.

    Hi,
    At what time do you want to modify the drop down list, while creating or after creating the dispute case. There are some BADI's where we can change the attribute drop down list values.
    Thanks,
    Sunil

  • How to get metadata option list values derived from a table/view using SOAP

    I am writing an ASP.NET application that replicates some of the features of the SCS search interface. I have looked at the GET_DOC_METADATA_INFO service and its SOAP output. It has a few missing pieces of information, like the option list values for a field if that fields values are derived from a separate table/view. Some of the fields I am dealing with also make use of Dynamic Control Lists (DCL). Is there a way to get the DCL info using SOAP? I did notice that the dOptionListKey element contains the name of the view from which the option list values will be derived. However, I cannot find a service that takes the view name as a parameter to return the option list values. I have looked in the services reference manual, but I have not had any luck finding what I am looking for.
    TIA
    - Tyson
    Message was edited by: Add the word 'get' to the subject.
    Tyson

    Hello,
    What error you are getting? You code seems to be ok. I have tested below code and working fine
    XPathNavigator rTable = MainDataSource.CreateNavigator();
    String ddlSectionSelectedValue = Convert.ToString(rTable.SelectSingleNode("/my:myFields/my:ddlSection", NamespaceManager).Value);
    One think you can check that keep dropdown value display name and id same.
    Hemendra:Yesterday is just a memory,Tomorrow we may never see<br/> Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • How to use a select list value in a PL/SQL function body returning SQLquery

    Hi Friends,
    I have a select list P6_TEST with values 'nav' anf 'jyo'. I am trying to create a report using "SQL Query (PL/SQL
    function body returning SQL query)". In my report query can i check if P6_TEST='nav' and do something like the
    code shown below.How can i do that.
    DECLARE
    v_sql VARCHAR2(3000);
    BEGIN
    IF :P6_TEST = 'nav' THEN
    v_sql :=
    'SELECT
    * from department';
    ........................Thanks,
    Nav

    Nav:
    What you have should work. Give it a go. Post back if you run into issues.
    Varad

  • How to delete the existing list values before binding

    Hi,
    I'm new for flex..
    i like to know how to delete(clear) the existing list data values before binding the new values..
    I'm using the list for binding data dynamically by using http services.if i send the another call mean's the exiting item should be flushed and  coming  data item's would be binded into the same list...
    Thank's in advance....
    Regard's
    mani

    Hello
    On your ResultEvent method you can add something like this:
    private function onResultEvent(event:ResultEvent) : void
         yourBindableList = null;
         yourBindableList = event.result as ArrayCollection();
    In this code i send to my BindableList a null value before i setter to list the result of my HTTPService, making a cast to ArrayCollection.
    Regards

  • Org Modeler 3.0 : Hierarchies - how to turn off employee listing

    Hi,
    I'm in Org Modeler 3.0
    In Source Org Chart -> Hierarchies -> Org Structure, there are 2 position and employee. We only want to show Org Unit and Position in the View, thus, we need to turn off Employee. However, there is no enable / disable button. Does anyone know to turn it off?
    (In Org Chart 3.0, Employee is placed under a different hierarchy, so I can easily disable it. But I can't do the same in Org Modeler).
    Thanks.

    Hi there,
    Your post is a bit confusing because you mention listing in the subject (which can be disabled in the AdminConsole) but your post is referring to the Employee hierarchy of the Organization Structure orgchart.
    You'll need to disable this directly in the XML file for the SAPOrgUnitOrgChart orgchartconfiguration object. Copy a version to your .delta folder and open it for editing. In the hierarchies section comment out or delete the <hierarchy>SAPEmployeeHierarchy</hierarchy> declaration. Then go through the rest of the configuration file and remove/comment out any object references to the SAPEmployeeHierarchy.
    Good luck!
    Luke

  • How do i check the list of invoices which are not posted into sap.

    Hi All,
    Iam displaying(ALV) the list of invoices and epayments for both PO & non PO transactons which are being processed in workflow but not posted in sap.
    (Non po transaction is th eone with out reference of a PO)
    How to check and list out the invoices that are not posted in sap. where does this get stored.
    please help.
    Thanks
    jyothi.

    Hello Jyothi,
    U can give try with EKBE table for getting invoices for PO. In this table there is a field vgabe which has various status. U can try that. Now for Non PO, u would be directly creating invoice doucment using FB60(i guess) which would create an entry directly into BKPF/BSEG. U can scan BKPF for the date range company code document type KR which vendor invoice.

  • How do I extract the list from a pop up menu back into Numbers?

    Hey guys
    I made a few very large lists in pop-up menus in Numbers, and I would like to extract those lists and put them
    in a seperate Numbers file.
    Is there a way that I can take the lists I made and sort of copy paste them /export them / extract them, so I don't
    have to manually copy them?
    Thanks in advance!
    Derk

    Hi Derk,
    Numbers doesn't seem to allow access to the values within a Pop-Up Menu, either through the native interface or through AppleScript.
    However, if you are using Numbers 3.2 and you have a long column formatted as Pop-Up Menu where you have "used" each the choices in the menu somewhere in the column, then you can collect a list of those values with the script below.
    Copy the script into AppleScript Editor.
    Select the cells in the body of your column formatted as Pop-Up Menu.
    Click the green triangle 'run' button.
    Click once in a destination cell in any Numbers document.
    Command-v or Edit > Paste & Match Style to paste the list of values.
    SG
    --places values from cells formatted as Pop-Up onto clipboard for pasting
    try
              tell application "Numbers"
                        set t to front document's active sheet's first table whose selection range's class is range
                        set {valuesList, valuesStr} to {{}, ""}
                        tell t's selection range to repeat with aCell in cells
                                  if aCell's formatted value is not in valuesList then
                                            copy aCell's formatted value to end of valuesList
                                            set valuesStr to valuesStr & aCell's formatted value & return
                                  end if
                        end repeat
                        set the clipboard to valuesStr
                        display notification "Click a cell and command-v to paste." with title "Numbers"
              end tell
    on error
              display alert "Did you select cells before running."
    end try
    --end of script

  • How do I store a list of contacts from an existing email into a new list

    I am trying to store a list of email addresses from an email I received into a new list in Address Book.
    How do I easily do this?
    Thanks
    PB G4   Mac OS X (10.3.9)  

    There is a collection of AppleScripts called Mail Scripts you can download at this link.
    http://homepage.mac.com/aamann/Mail_Scripts.html
    The script to use from the collection of scripts is Add Addresses (Mail) which adds addresses found in the selected messages (in the header fields "From", "To", "Cc", "Bcc", and "Reply-To") to the Address Book. This is much more flexible than the "Add Sender to Address Book" available in Mail and provides a convenient way for creating mailing lists.

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

  • How to get values/data stored in the database into a list-item.

    how to get values/data stored in the database into a list-item.
    i tried to make a list item without any values assigned to it...but i got the below error.
    FRM-30191: No list items defined for required poplist.
    or
    FRM-32082: Invalid value for given item type.
    List EMPNO
    Item: EMPNO
    Block: EMP
    Form: MODULE5
    FRM-30085: Unable to adjust form for output.
    then according to some docs, i tried the the following for the trigger
    when-new-form-instance
    declare
         rg_name varchar2(40) := 'emp_rec';
         status number;
         groupid recordgroup;
         it_id item;
    begin
         it_id := Find_Item('empno');
         groupid := create_group_from_query(rg_name, 'select empno from emp');
         status := populate_group(groupid);
         populate_list(it_id, groupid);
    end;
    but yet didnt work... :(
    so how the heck do i get values fetched from the database table into the list item?

    for list items you need to values in the record group, one is the shown value and one is the returned value.
    Check out the online help for the populate_list built-in.
    You'll need something like select ename,ename from emp as the record group query.

Maybe you are looking for