Setting current values in Multiple Select List in SQL Query based Report

Hi,
I have a report based on a sql query that contains a multiple select list. Unfortunately I cannot get the multiple select list to display the current values (p_value) correctly. I have created a page item, :p311_current_versions, that is set using a pre-header process and it returns a value with a colon delimited format e.g. '10.1.2.1.0:10.1.2.2.0'. Then this item is used in the sql query to set the current value (p_value) of the apex_item.select_list_from_query function. However when the table is displayed, instead of having two entries, 10.1.2.1.0 and 10.1.2.2.0 selected, it has an extra entry '10.1.2.1.0:10.1.2.2.0' selected.
Here is my code:
select distinct a.product, a.version from (
select distinct
apex_item.display_and_save(2,product)||apex_item.hidden(1,env_product_id) PRODUCT,
APEX_ITEM.SELECT_LIST_FROM_QUERY(3,decode(product, 'HTTP Server' , :p311_current_versions, version), 'SELECT distinct version d, version r FROM ebs_tech_stack where
product ='''||PRODUCT||'''',
decode(PRODUCT, 'HTTP Server' ,'multiple="multiple" style="width:170px"','style="width:170px"'),
'NO') as version
from ebs_environment_tech_stack
where environment_id = :p311_umgebung_id) a order by a.product
If anyone can help me figure out how to set the current values correctly I'd be really grateful!!
Thanks in advance,
Jean

Jean,
I don't think this is possible using the apex_item package. The select_list_from_query function accepts only a single value for the second parameter.
Scott

Similar Messages

  • Value of Multiple-Selection List box is not appearing "calculated value" field of it

    Hello,
    We have created one selection list box using control "Multiple Selection List Box", where user can select one or more values.
    We have created one view in InfoPath form, which have calculated value of fields(just showing purpose and printing purpose this view has ben created).
    In this when we try to show calculated value of field is of Multiple Selection List Box, it's showing as "Off".
    Could you please help us out.
    Thanking you in advance.
    Regards,
    Jayashri

    Hi,
    Thanks for your sharing! It will be beneficial to others in this forum who meet the same issue in the future.
    Wendy
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Using Multi Select List in SQL Query

    Hi all,
    I am trying to using a Multi Select list for filtering of a report. I have :P2_RISK_SEVERITY which has has the possibility of values Very Low:Low:Medium:High:Very High. How do I use this Multi Select in the where section of a SQL query?
    I need to say something along the lines of:
    Select RISK_SEVERITY from TBL_RMD_RISKS where RISK_SEVERITY = (one of the options selected in the multi select)
    Thanks for the help.

    Hi there,
    The above suggestion will work perfectly as long as the table you're querying is relatively small, but keep in mind that applying the INSTR to the left side of the WHERE clause will always result in a full table scan. This means that if your table is large and RISK_SEVERITY is indexed, the index will never be used. Here is another approach (credit to AskTom) that converts your colon-delimited string of selected values to a list that can be used in an "IN(...)" clause, which will use an index on RISK_SEVERITY as long as the optimizer otherwise deems it appropriate:
    -- creates a type to hold a list of varchars
    CREATE OR REPLACE TYPE vc2_list_type as table of varchar2(4000);
    -- converts a colon-delimited string of values to a list of varchars
    CREATE OR REPLACE FUNCTION vc2_list(p_string in varchar2)
       return vc2_list_type is
       l_string       long default p_string || ':';
       l_data         vc2_list_type := vc2_list_type();
       n              pls_integer;
    begin
       loop
          exit when l_string is null;
          n := instr(l_string, ':');
          l_data.extend;
          l_data(l_data.count) := ltrim(rtrim(substr(l_string, 1, n - 1)));
          l_string := substr(l_string, n + 1);
       end loop;
       return l_data;
    end vc2_list;
    -- your WHERE clause
    where risk_severity in(
             select *
               from the(select cast(vc2_list(:P2_RISK_SEVERITY) as vc2_list_type)
                          from dual))
    ...Hope this helps,
    John

  • Setting the cell width in a Tabular Form (SQL Query (updateable report) )

    version 3.2.1
    I have a Tabular Form (SQL Query (updateable report) ) and I have a column that is a VARCHAR2(4000) that when displayed extends the cell to the full length (which of course makes sense).
    How can I set the width of this cell to something like 30 or 50 and wrap the contents?
    Thanks,
    Joe

    Scott,
    Thank you for replying.
    Your suggestion kinda worked. I say kinda because when the report is first displayed the cell is the full width and appears to ignore the width setting. There is a Select List on the report to restrict some of the data that is displayed. When a selection is made from this Select List, it appears that the cell width is then adjusted to what was set, but not for every selection from this Select List.
    I made the width entry in Tabular Form Element - Element Width
    Any idea why the width setting is ignored?
    Thanks,
    Joe

  • Set Default Value of Multi-select list item

    I have a multi-select list item I want to default the value of to '%' (which is really '%null%') and have it selected. I tried setting default value of item, but it doesn't take '%null%'. I also tried a computation with a static of
    :P507_ITEM := '%null%'; How do you get the default value set and selected?

    Hi
    Shijesh is right, you need to change your null return value and use that return value as your default. Try and use something of the same datatype as your real return values if you plan to use '%' to display all as it will make your queries simpler. eg.
    Company A returns 1
    Company B return 2
    % returns 0
    Then your query would be...
    SELECT ...
    FROM ...
    WHERE company_id = DECODE(:P_COMPANY,1,1,2,2,0,company_id)
    Hope this makes sense.
    Cheers
    Ben

  • Select MULTIPLE default values for a multiple selection list box based on another field in Infopath 2010

    Hello there - Before I explain my issue, I would like to point out that I have reviewed some other discussions on selecting default values for multiple selection listbox. But my issue is specific and different, and not answered by any of the discussions
    I visited.
    I have a multiple selection list box (say for example all countries in the world as values), and I would like to pre-select or setup multiple default values (say five countries) based on some criteria that I query from MS SQL database table.
    I know we can go to Data | Default Values option to setup one or many default values for multiple selection list box. When I enter the default values manually this works. I also right click the field under the Multiple-Selection List Box group, then select
    Add another Value Below and set the Default Value for this field to setup multiple default values.
    However, if I reference a field (either an infopath field or a field from SQL database) I am not able to setup multiple default values. Infopath automatically selects the last field I selected for all instances and in the end I am able to see only one
    default value selected instead of many. How to fix this problem? Why would infopath allow multiple default values when we enter it manually but not when we reference some fields?
    Please let me know if you need more info. Appreciate your help.
    Thanks!

    Hi redhotc,
    According to your description, my understanding is that you want to set multiple default values for a multiple checkbox list in InfoPath form.
    I did a test with SQL database table. I set three default values for the checkbox list by adding three values field under the group field(Data->Default values), each value field is for a default value. Then publish it to my SharePoint site, everything
    was fine.Please have a try as the below link:
    http://www.bizsupportonline.net/infopath2010/pre-select-items-multiple-selection-list-box-infopath-2010.htm
    Note: if you are using SQL databse table, you may need to enable ‘Allow cross-domain data access for user form templates that use connection settings in a data connection file’ in CA. More information, please refer to:
    http://answers.flyppdevportal.com/categories/sharepoint2010/sharepoint2010customization.aspx?ID=418b9423-a96c-4e5e-91f9-6a1b010ebb69
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

  • Multiple Select List Box default value ysing Fx or Code

    Hello,
    If anybody could help me in figuring out how to set default or customized values (checked) for a multiple select list box in infopath based on a values in a secondary data connection using the fx function or code, instead of manually typing in text in the
    default value function, it would be really helpful. Have been stuck for eternity in this 
    I have a temp table now which has each student name and the subject separtely
    something like this 
    Student Name       Subject  
    AA                              
    English
    AA                              Maths
    So that in my infopath form if I choose a student name in a drop
    down box the multiple selection list box has the values of the subject chosen by the student checked

    Hi,
    Please check the link below and see if it can meet your requirement:
    http://basquang.wordpress.com/2010/03/29/cascading-drop-down-list-in-sharepoint-2010-using-infopath-2010/
    Here is the design for your scenario:
    List1 for subject name
    List2 for student and subject (just as your temp table)
    Then you could create cascading drop-down in InfoPath form.
    Regards,
    Rebecca Tu
    TechNet Community Support

  • How can i display Value in Report which i select from Multiple select list

    Dear All,
    i am using multiple select List in form with report page.
    When i create new Entry with select Multiple value in Multiple Select List then in report Value display me in below format
    my SQL Query are
    select NAME D, CODE R from  COUNTRY_MAS WHERE ACTIVE_FLG ='Y' order by NAME
    AS:AI:AG:AM these are return value .i want to display NAME in report .
    How can i do this ?
    Thanks
    Edited by: Vedant on Apr 25, 2012 11:14 PM

    Short answer, use the apex_util.string_to_table to convert to a table; then you can either iterate through the table to generate a string of names, or accomplish the same with a bulk operation.
    http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21676/apex_util.htm#CHDFEEJD
    Encapsulate all this within a pl/sql function.

  • Multiple Select List does not Refresh with Dynamic Action

    All,
    Scenario:
    Using APEX 4.2.2, I have a Select List page item (P4_SPONSOR) set to allow multiple values which has a dynamic LOV to populate the list.  What I would like to do is highlight the display values based on another page item's value (P4_DRIVER_ID).  When I set the source of P4_SPONSOR to static text, such as a delimited string of 1:2:3:4, any display values where the return values are equal to the static text are highlighted when the page loads.
    Problem:
    The problem lies in trying to use a query as a source for P4_SPONSOR which is filtered based on the other page item, P4_DRIVER_ID.  For instance, my SQL Query (returning colon separated values) returns the same as the static text noted above.  In the query's WHERE clause, I specify that the driver's ID is equal to P4_DRIVER_ID:
    SELECT sponsor_id
    FROM sponsors_drivers_xref
    WHERE driver_id = :P4_DRIVER_ID;
    This, as I understand it, would necessitate a refresh of P4_SPONSOR whenever the value of P4_DRIVER_ID changes.  So, I have a Dynamic Action that does just that.  When executed on the page, I can see the P4_SPONSOR multiple select list actually refresh, but none of the display values become highlighted.
    Thoughts?
    Thanks,
    -Seth.

    Seth,
    A dynamic action refresh of your select list will refresh the list of values (this is what you are seeing), it will not refresh the value of the item itself.  In fact, it will remove any values that you had already selected.  To refresh the value you will need to add additional dynamic actions.
    Create another dynamic action with:
    Event: After Refresh
    Selection Type: Item(s)
    Item(s): P4_SPONSOR
    If this was a normal select list you could just create a Set Value action and use your query to set the value of the select list.  Since this is a multiple select list your will need to get your colon delimited value first and then use some javascript to set the values of your select list.
    Create an hidden page item name P4_SPONSOR_TEMP.
    Add a true action to your new dynamic action:
    Action: Set Value
    Set Type: SQL Statement
    SQL Statement:
    SELECT sponsor_id
    FROM sponsors_drivers_xref
    WHERE driver_id = :P4_DRIVER_ID;
    Page Items to Submit: P4_DRIVER_ID
    Selection Type: Item(s)
    Item(s): P4_SPONSOR_TEMP
    Add another true action to your new dynamic action:
    Action: Set Value
    Set Type: JavaScript Expression
    JavaScript Expression:
    $("#P4_SPONSOR_TEMP").val().split(":")
    Selection Type: Item(s)
    Item(s): P4_SPONSOR
    --Jeff

  • InfoPath 2010 - Multiple Selection List Box - Rule Does Not Run When Unchecking Value

    I have a multiple selection list box on a form. I have a rule that sets the value of another field. There is not condition. Just any time item is checked or unchecked the value of the other field should
    change. This works when checking an item in the list box but not when unchecking the item in the list box. My question is - do rules not fire for a multiple selection list box when unchecking an item?

    Hi,
    I have tested in my lab environment, the rules seemed only fire for the latest checking action, and it did not fire when uncheck multiple-selection list box. Here is a workaround for your reference:
    http://www.infopathdev.com/forums/p/17850/62269.aspx
    However, I’d recommend you use check box instead, since it is much easier to set rule according to value of it. We can set it as true when we check the box, and set it as false when we uncheck it as below:
    Then it is simple and clear to make rule according to the value of check box.
    Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety,
    or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.
    Regards,
    Rebecca Tu
    TechNet Community Support

  • Set focus on item that selected in multiple-selection list box field in infopath

    Hi
    I have  multiple-selection list box field in infopath that have for example 40 items. (I customize sharepoint list with infopath),then
     publish infopath form in to sharepoint list. users want to add new item,when they selected or checked each item in multiple selection list box, after that automatically control focus on first item, but I want to focus remain on that item
    I was selected. Why this happen?! I also set postback settings to “never” in multiple-selection list box properties. But didn’t work.
    Thanks.

    Hi,
    According to your post, my understanding is that you wanted  to find several columns based on user selection of checkboxes in one of the Multiple-selection List Box.
    I recommend to customize the form to concatenate values from choice field (with multiple values) into single line text box, and then hide the fields based on the text box value.
    We can follow the steps as following:
    Add a text box control(filed 3) on the form to hold the value selection in the multiple selection list box.
    Set the default value for the text box control as
    substring-after(eval(eval(Value, 'concat(., ";")'), ".."), ";")
    (you need to change the ‘Value’ in the formula to your multiple selection list box name: filed1).
    Add the conditional formatting on the flied: flied 3 does not contain value (you need to change the ‘Value’ in the formula to your multiple selection list box value.).
    In addition, you can add Formatting action to hide the text box control.
    Here are the result screenshots for you to take a look at:
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • Multiple Select List not returning multiple values

    I have created a Multiple Select List, and the manual says that when multiple values are selected and the page is submmitted (I'm using a GO button), the multiple values are put into the ITEM field, separated with a colon . However, whenever I select multiple entries in my list, it only ever returns a value for the first item (like a single select list).
    Does anybody know what I may have missed ? I'm still fairly new to this stuff, so I'm hoping it's fairly simple!
    thanks.
    p.s I'm using a dynamic list of values.

    Andy / Scott,
    Sorry, please bear with me ... still new to this.
    I have a multi select list item in page 2, called P2_MULTI_LIST. When the page is submitted, I no longer physically pass it to page 3, but how would page 3 pick up the value ? Do I need to set up a P3_MULTI_LIST item in page3 and set that item to the P2_MULTI_LIST value, or do I reference P2_MULTI_LIST directly in my Page3 SQL query ?
    Also, if I then want to propogate the value in P2_MULTI_LIST down to another page from page3, via a link in a report, is this possible ?
    thanks
    Tim

  • Multiple selection list and passing that value to oracle reports

    Hi
    I need to create a multiple selection list and then based on use selection, I need to pass that value to oracle reports. Can any one help with steps on how I can do this. Thanks

    Hi
    Concatenate the multiple values into a string separated by comma and then pass that string to report as a parameter.
    In report query, you have to use the lexical parameter using ' & '
    regards
    SD

  • Multiple-Selection List Box Values in Multiple Columns

    I am using InfoPath 2010 with SharePoint 2013. I have a form with a multiple-selection list box which has A LOT of choices. Instead of displaying all the choices in one column, is it possible to display the values of my list box in several
    columns? 

    Hi Andrea,
    I agree with Brij, one multiple-selection list box is associated with one list field, we cannot use the one multiple selection list box value for other multiple selection list boxes, we need to create multiple choices for each multiple-selection list box
    control in InfoPath form.
    Thanks
    Daniel Yang
    TechNet Community Support

  • Multiple Select List looping thru PL/SQL function body returning SQL query

    Hi,
    I have a Multiple Select List. I want to loop through the values from the Select List and process them in a PL/SQL function body returning a SQL query. Currently, my code only returns the SQL SELECT results of one item in the select list. How do I change my code to make it return the results of all of the items in the select list? (I tested it and it is definitely picking up all the values in the select list).
    <b>
    DECLARE
    selected_items HTMLDB_APPLICATION_GLOBAL.VC_ARR2;
    s   VARCHAR2(20);
    q varchar2(32767);
    BEGIN
    selected_items := HTMLDB_UTIL.STRING_TO_TABLE(:P50_SELECTED_INSTRUMENTS);
    -- htp.p('COUNT: '||selected_items.count);
      FOR i in 1..selected_items.count LOOP
      s := TO_CHAR(selected_items(i));
    -- htp.p('First: '||s);
    -- htp.p('Second: '||:s);
    -- htp.p('Third: '||TO_CHAR(selected_items(i)));
      q:= 'SELECT  '||
    'SUBSTR(orig_geo_loc_sys,1,INSTR(orig_geo_loc_sys,''-'')-1) AS INSTRUMENT, '||
    'SUBSTR(orig_geo_loc_sys,INSTR(orig_geo_loc_sys,''-'')+1, LENGTH'||
    ' (orig_geo_loc_sys)) AS ORIG_LINENUM, '||
    'sum(orig_intrl) orig_intrl, '||
    'sum(orig_extrl) orig_extrl, '||
    'sum(recv_intrl) recv_intrl, '||
    'sum(recv_extrl) recv_extrl '||
    'FROM line_usage_sum_view '||
    'WHERE TO_CHAR(orig_geo_loc_sys) LIKE ''' || s ||'%'' '||
    --'WHERE TO_CHAR(orig_geo_loc_sys) LIKE ''2213003%'' '||
    'AND switch_id = ''' || :P1_SWITCH_ID || ''' ' ||
    'AND call_start_date > TO_DATE(''30-NOV-1999'') ' ||
    'AND call_clear_time > TO_DATE(''30-NOV-1999'') '||
    'AND '||
    :SORTFIELD||' BETWEEN '||
    'TO_DATE(:STARTDATE,''dd-MON-YYYY HH24:MI'') AND '||
    'TO_DATE(:STOPDATE, ''dd-MON-YYYY HH24:MI'') '||
    'GROUP BY GROUPING SETS (orig_geo_loc_sys)';
    -- htp.p('SQL query: '||q);
      RETURN q;
      END LOOP;
    END;</b>
    Thank you,
    Laura

    Laura,
    First, I would be careful of introducing SQL Injection possibilities. Any time I see
    'Select ... ' || :P123_FOO || ' ... '
    I worry about sql injection. In your case you are converting :P50_SELECTED_INSTRUMENTS into selected_items and then selected_items into s. So when I see
    'WHERE TO_CHAR(orig_geo_loc_sys) LIKE ''' || s ||'%'' '||
    I think, "I could use sql Injection and hack this."
    So, I would do some validation on :P50_SELECTED_INSTRUMENTS or some other method to avoid this.
    I'm not certain I understand your query. Do you really intend to allow the user to select the beginning of a string and then find all rows that start with that string? Or, do you just want to let them find when it matches the string. This is one way if you want to do matching:
    DECLARE
    selected_items HTMLDB_APPLICATION_GLOBAL.VC_ARR2;
    s VARCHAR2(32767);
    q varchar2(32767);
    BEGIN
    -- Change the : separate string to be comma separated with quoted strings
    s := '''' || replace(:P50_SELECTED_INSTRUMENTS, ',', ''',''')|| '''' ;
    -- htp.p('COUNT: '||selected_items.count);
    q:= 'SELECT '||
    'SUBSTR(orig_geo_loc_sys,1,INSTR(orig_geo_loc_sys,''-'')-1) AS INSTRUMENT, '||
    'SUBSTR(orig_geo_loc_sys,INSTR(orig_geo_loc_sys,''-'')+1, LENGTH'||
    ' (orig_geo_loc_sys)) AS ORIG_LINENUM, '||
    'sum(orig_intrl) orig_intrl, '||
    'sum(orig_extrl) orig_extrl, '||
    'sum(recv_intrl) recv_intrl, '||
    'sum(recv_extrl) recv_extrl '||
    'FROM line_usage_sum_view '||
    'WHERE TO_CHAR(orig_geo_loc_sys) in (' || s ||' ) '||
    --'WHERE TO_CHAR(orig_geo_loc_sys) LIKE ''2213003%'' '||
    'AND switch_id = ''' || :P1_SWITCH_ID || ''' ' ||
    'AND call_start_date > TO_DATE(''30-NOV-1999'') ' ||
    'AND call_clear_time > TO_DATE(''30-NOV-1999'') '||
    'AND '||
    :SORTFIELD||' BETWEEN '||
    'TO_DATE(:STARTDATE,''dd-MON-YYYY HH24:MI'') AND '||
    'TO_DATE(:STOPDATE, ''dd-MON-YYYY HH24:MI'') '||
    'GROUP BY GROUPING SETS (orig_geo_loc_sys)';
    -- htp.p('SQL query: '||q);
    RETURN q;
    END;
    If you want to do something more like you originally stated, try this:
    DECLARE
    selected_items HTMLDB_APPLICATION_GLOBAL.VC_ARR2;
    s VARCHAR2(20);
    q varchar2(32767);
    BEGIN
    selected_items := HTMLDB_UTIL.STRING_TO_TABLE(:P50_SELECTED_INSTRUMENTS);
    -- htp.p('COUNT: '||selected_items.count);
    q:= 'SELECT '||
    'SUBSTR(orig_geo_loc_sys,1,INSTR(orig_geo_loc_sys,''-'')-1) AS INSTRUMENT, '||
    'SUBSTR(orig_geo_loc_sys,INSTR(orig_geo_loc_sys,''-'')+1, LENGTH'||
    ' (orig_geo_loc_sys)) AS ORIG_LINENUM, '||
    'sum(orig_intrl) orig_intrl, '||
    'sum(orig_extrl) orig_extrl, '||
    'sum(recv_intrl) recv_intrl, '||
    'sum(recv_extrl) recv_extrl '||
    'FROM line_usage_sum_view '||
    'WHERE 1=1 ';
    FOR i in 1..selected_items.count LOOP
    s := TO_CHAR(selected_items(i));
    q := q || ' and TO_CHAR(orig_geo_loc_sys) LIKE '''|| s ||'%'' ' ;
    END LOOP;
    q := q || ||'%'' '||
    --'WHERE TO_CHAR(orig_geo_loc_sys) LIKE ''2213003%'' '||
    'AND switch_id = ''' || :P1_SWITCH_ID || ''' ' ||
    'AND call_start_date > TO_DATE(''30-NOV-1999'') ' ||
    'AND call_clear_time > TO_DATE(''30-NOV-1999'') '||
    'AND '||
    :SORTFIELD||' BETWEEN '||
    'TO_DATE(:STARTDATE,''dd-MON-YYYY HH24:MI'') AND '||
    'TO_DATE(:STOPDATE, ''dd-MON-YYYY HH24:MI'') '||
    'GROUP BY GROUPING SETS (orig_geo_loc_sys)';
    -- htp.p('SQL query: '||q);
    RETURN q;
    END;
    Hope this helps...
    Anton

Maybe you are looking for