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.

Similar Messages

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

  • 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

  • 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

  • Impact of selecting "Removing Query from Selection List" in 2 channels.

    HI All ,
    I have customized a query in one channel (My Agreements and Contract Documents query in Master Agreements List channel) and have removed the standard query from the channel by checking the  "Remove Query from Selection List" and introduced my custom query in that query group .
    But  it resulted in break in chain for  "Master Agreements" link in "Contracts To Do List" channel as the link was pointing to standard  "My Agreements and Contract Documents" query and is displaying "The query can not be executed. Contact your system administrator" when ever I click on that.
    Any pointers on how to overcome above scenario wud be gr8!
    Regards,
    Uday

    Hi Uday,
    In order for To Do List channel to work, the query definition should be in the Master Agreement List query group. Do you still want the standard query in the To Do List? If so, you would have to leave it on the Query Group as To Do list is pointing to it. May be change the display name of the query so you can differentiate between the 2 queries. The other option is change the To Do channel to point to the custom query.
    Regards,
    Vikram

  • 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

  • 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

  • Query regarding updating rows in JTable

    Query regarding updating rows in JTable
    Hello,
    I have a JTable with 6 columns and 1000s of rows (which are data read from flat files)
    I can select 1 or more rows and change the values of the
    columns. each time I do this I need to update the values
    in the flat file.
    Currently I assign the updated Jtable values to a vector
    Vector rowVector = (Vector)defaultModel.getDataVector();
    then I iterate over the vector and compare the values with the (old) data
    in the JTable.
                for(int rowCount = 0; rowCount<rowVector.size(); rowCount++){
                    Vector v = (Vector)rowVector.elementAt(rowCount);
                        //smsList is the Vector that contains the old JTable values
                        for(int i=0; i<smsList.size(); i++){
                                //If colums values have been changed; add that
                                //vector value to another vector
                                selectedsmsList.add(smsList.get(i));
                for(int i=0; i<selectedsmsList.size(); i++){
                         //Update the values in the flat file
                }This works fine except that it takes ages to iterate over the updated vecor and un-updated,old vector; is there any way to directly get the list of rows that were updated in the jtable; so that I can directly do an I/O operation to update the jtablke values?

    Just a suggestion.
    You could add a listener and use a vector of booleans to keep track of the rows that have been changed. You could then iterate through this boolean vector and update the changed rows.
    See
    http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#modelchange
    Don't know whether this will be helpful.
    Regards, Darryl

  • Multiselect List selected by default

    Hi, I have a Multiselect List populated with a LOV (elements in the "name" column of "TAB1").
    I would like that if "TAB1"."check" = 1 the name into my Multiselect List was SELECTED when page is charged but I found nothing about that.
    Do you have some suggestions ???
    THANK YOU ...

    Your solution is OK if my table is static but it isn't.
    If I use static / sam:pet when I update table with a new item Multiselect is not updated.
    I need to use the result of the query:
    select name
    from TAB1
    where check = 1
    and select these item into my Multiselect List where source code is:
    select name
    from TAB1
    Something like:
    DECLARE my_table wwv_flow_global.vc_arr2;
    begin
    SELECT name INTO my_table
    FROM TAB1
    WHERE check = 1;
    FOR i in 1..my_table.count
    LOOP
    P1_SELECT.value (my_table(i)) = CHECKED;
    END LOOP;
    end;
    I konw this code is not right but just to give you an idea of the way it has to work.
    THANKS

  • My query prompts does not appear in the Query prompt order list!

    Dear colleagues,
    All of my query prompts does not appear in the Query prompt order list in properties of the query. It seems random which of them that appears there and not.
    This makes it impossible for me to control or change the order of prompts, instead they order themselves alphabetically.
    Is this some kind of bug? Is there a fix for this problem?
    Regards
    Silje

    Hi Stratos,
    We use Edge.
    Correction- we use Enterprise, changed a few months ago!
    By the way, we heard about a bug that probarly causes the problem.
    If the query has ever had a prompt containing 'Between', all prompts created afterwards will not appear in the prompt order list! Even if the between-prompt is deleted.. We still havent heard about a fix for this, please contact me if you hear anyting. It is not an option to create all the queries from scratch again!
    Silje
    Edited by: Silje Mari Sunde on Oct 22, 2009 9:24 AM

  • 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

  • Is there an accurate query to  provide list of all objects grown in the past between 2 intervals ?

    Please Advice
    I need accurate query to  provide list of all objects grown in the past between 2 intervals as one provided in Doc ID 1395195.1 is not giving accurate results and DBMS_SPACE.OBJECT_GROWTH_TREND is not giving objects name
    Kind Regards

    user13778506 wrote:
    Please Advice
    I need accurate query to  provide list of all objects grown in the past between 2 intervals as one provided in Doc ID 1395195.1 is not giving accurate results and DBMS_SPACE.OBJECT_GROWTH_TREND is not giving objects name
    Kind Regards
    only possible if  you collect object sizes on a regular basis & store the details after each collection.
    what unit  of measure should be used to quantify the "growth"; rows, blocks, segment, extent?
    Some might consider this level of  detail to be symptomatic of Compulsive Tuning Disorder.

  • How to unselect an item in a multiselect list?

    Hi all,
    I am displaying a static lov as a multiselect list. And when I select the item in the list, the item is highlighted and I am displaying a region. Now I need to unselect that item and hide the corresponding region. No database transaction is involved. Can anyone please give me some hints?
    Rgds,
    Suma.

    When you use a select list that allows for multiple selections, the "value" attribute is only the first one selected.
    For example, if you had 3 options on the list with their "value" attributes set as "A", "B" and "C" and selected A and C, alert(document.getElementById("xxx").value) would display "A" not "A;C".
    What you need to do is to loop through each of the options and see if its "selected" value is "true". Something like:
    function testForSelected()
    var i;
    var x = document.getElementById("X");
    var o;
    for (i = 0; i < x.options.length; i++)
    o = x.options;
    if (o.value == "A" && o.selected == true)
    alert("A is selected");
    Where "X" is the multiselect list and "A" is the value of the option item you want to test for. Replace alert(...) with your show/hide function call.
    Regards
    Andy

  • Repopulating a multiselect list with saved values

    Hi,
    I am new to using HTML DB and have been searching the Internet on information I could find about it.
    I found some useful information about multiselect boxes and can get the inserts to work but I am having problems with the repopulating of the multiselect from the underlying table.
    I am using the following code to get the information from the table and the process point is On Load - After Header.
    DECLARE
    l_selected HTMLDB_APPLICATION_GLOBAL.VC_ARR2;
    BEGIN
    SELECT risk_owner_id BULK COLLECT
    INTO l_selected
    FROM rmd_risk_risk_owners
    WHERE risk_id = :P34_RISK_ID;
    :P34_RISK_OWNER_ID := HTMLDB_UTIL.TABLE_TO_STRING( l_selected );
    END;
    but the multiselect list doesn't seem to repopulate with the values.
    Does anyone have an idea I what I could be doing wrong from their previous experience. Any suggestions would be appreciated.
    Regards,
    Scott.

    Lets break the problem statement in multiple steps
    1. We need a way to know the selection on all rows.
    2. We need the association of the checkBox with the data
    The  solution is to use a arrayCollection/array that holds all the instances  created for checkbox.This collection should be a property of component  containing the datagrid. We need to use a custom component  implementation or inline ItemRenderer. The way you have used is called  dropinItemRenderer. Preferaly use custom component implementation and  add the instance to the arrayCollection at CreationComplete. Make sure  you use addItemAt so that you add the instance in the same row as the  data. To get rowIndex the custom Checkbox should implement  IDropInListItemRenderer. You could iterate this collection to check all  the instances that are checked.
    Note: This is the approach considering your dataprovider doesnt have a selection field.
    Nishant

  • Query regarding direct path write

    Hi All,
    We have Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production running on Redhat 4.
    We have performance issue with high disk utilization.
    When seen statspack report, top event is always direct path write.
    when checked about direct path write found that it is consequence of direct path inserts/high sort operations.
    I checked v$sort_usage and identified query which is listed there most of time, but column segtype is HASH for that query.
    So is there chance i can conclude that this is the query which is causing direct path writes as confusing thing is SEGTYPE is HASH.
    Please let me know your comment about the same and also is there a way i can find sql statement which are writing to temp tablespace using direct path write.
    Regards
    Vinay

    v$sql_workarea_active gives information about the active work areas in the system. It shows the operation type, sid, memory usage and temp tablespace usage. You can check this to see what session is using the temporary tablespace for work areas.

Maybe you are looking for

  • HP Elitebook 840 NIC issue

    Strange issue.  I have an Elitebook 840 with Windows 7 Enterprise 64 Bit.   Once installed, I copied the driver disk to an external drive and installed the drivers.  All the drivers have installed with one exception.  When the NIC driver installs, th

  • Loading a picture with as too fast than normal loading ?

    hello, i want to know if loading a picture from a server with a swf and show it on the stage, (to show it on the web browser) is slower than loading the picture normally (showing it with img tag). thank you for your answer

  • Remove Child Window from Parent using WIN API

    Hello all, I am using User32.dll to make a parent-child relationship between two VIs. I use SetParent function, and pass the handle of parent VI and child VI to this function. Now, after this relationship has been established, I want to remove the ch

  • I want to configure my Ipad2 with IPV6

    I want to configure my Ipad2 to use IPV6

  • Defense: Malware targeting Mac's

    Mac's users running any browser with JavaScript turned on by default are vulnerable to being tricked into clicking on a trick image and/or link. That image may appear to be a standard OS X window with a close box or the typical OS X looking window as