Bug while saving multi select list

Hi,
My requirement is to construct a region where user can select their answer from available option. answer field can be multiple select/single select or text area.
I have written below query to achieve different type of answer field.
/**query****/
DECLARE
v_sql VARCHAR2 (32767);
v_answer VARCHAR2 (32767);
v_main_sql VARCHAR2 (32767);
BEGIN
FOR cur IN (SELECT question_id, question, answer_type, available_answer FROM question WHERE status= 'ACTV')
LOOP
v_sql := 'SELECT ';
v_sql := v_sql || ' APEX_ITEM.hidden(4,question_id)||question question, '; /*do not show question id as per requirement*/
IF cur.answer_type = 'MS' -- Multi Select List
THEN
v_answer := cur.available_answer;
v_sql :=
v_sql
|| ' APEX_ITEM.SELECT_LIST_FROM_QUERY(3,null,''SELECT * from table(
AU_F_LOV_FN('''''
|| v_answer
|| '''''))'',''class="multiselect" multiple="multiple"'',''NO'') Answer ';
ELSIF cur.answer_type = 'SS'
THEN -- Single Select List
v_answer := cur.available_answer;
v_sql :=
v_sql
|| ' APEX_ITEM.SELECT_LIST_FROM_QUERY(3,null,''SELECT * from table(
AU_F_LOV_FN('''''
|| v_answer
|| '''''))'') Answer ';
ELSE -- Free text
v_sql := v_sql || ' apex_item.textarea(3,available_answer,2,20) Answer ';
END IF;
v_sql := v_sql || ' from question ';
v_sql := v_sql || ' where question_id=' || cur.question_id;
IF v_main_sql IS NULL THEN
v_main_sql := v_sql;
ELSE
v_main_sql := v_main_sql ||' UNION ' || v_sql;
END IF;
END LOOP;
RETURN v_main_sql;
END;
/***end of query***/
If I select two options from multiple select list it is saving two records into table instead of saving one record with colon delimeter.
/**query to save**/
FOR i IN 1 .. APEX_APPLICATION.G_F03.COUNT
LOOP
IF APEX_APPLICATION.G_F03(i) IS NOT NULL THEN
UPDATE question_answer
SET answer = v_answer
WHERE question_id = APEX_APPLICATION.G_F04(i)
and call_id=p_sourceid;
IF sql%rowcount =0 then
INSERT INTO question_answer (question_id,
answer,
call_id,
status,
customer_id)
VALUES (APEX_APPLICATION.G_F04(i),
nvl(v_answer,APEX_APPLICATION.G_F03(i)),
p_sourceid,
'ACTV',
p_customer_id);
END if;
END IF;
END LOOP;
/**End**/
Can anyone please help me? Why is it happening? How to tweak my query so that it saves one record with colon delimeter.

Technically, my understanding is that a Shuttle is just two multiselect lists where javascript moves the items from one to the other. Technically its the same thing, just different presentation and methods for selection. When you go to process, its seen the same way as you initially had your code setup so no code changes would have been necessary. As it's a built in item type and with APEX's backwards compatibility policies, if your code works now it should continue to work.

Similar Messages

  • How Do I Filter a Report Using a Multi Select List Box and Specifying Date Between Begin Date and End Date

    Hope someone can help.  I have tried to find the best way to do this and can't seem to make sense of anything.  I'm using an Access 2013 Database and I have a report that is based on a query.  I've created a Report Criteria Form.  I
    need the user to be able to select multiple items in a list box and also to enter a Begin Date and End Date.  I then need my report to return only the records that meet all selected criteria.  It works fine with a ComboBox and 1 selection but can't
    get it to work with a List Box so they can select multiple items.  Any help is greatly appreciated while I still have hair left. 

    The query should return all records.
    Let's say you have the following controls on your report criteria form:
    txtStart: text box, formatted as a date.
    txtEnd: text box, formatted as a date.
    lbxMulti: multi-select list box.
    cmdOpenReport: command button used to open the report.
    The text boxes are used to filter the date/time field DateField, and the list box to filter the number field SomeField.
    The report to be opened is rptReport.
    The On Click event procedure for the command button could look like this:
    Private Sub cmdOpenReport_Click()
    Dim strWhere As String
    Dim strIn As String
    Dim varItm As Variant
    On Error GoTo ErrHandler
    If Not IsNull(Me.txtStart) Then
    strWhere = strWhere & " AND [DateField]>=#" & Format(Me.txtStart, "yyyy-mm-dd") & "#"
    End If
    If Not IsNull(Me.txtEnd) Then
    strWhere = strWhere & " AND [DateField]<=#" & Format(Me.txtEnd, "yyyy-mm-dd") & "#"
    End If
    For Each varItm In Me.lbxMulti.ItemsSelected
    strIn = strIn & "," & Me.lbxMulti.ItemData(varItm)
    Next varItm
    If strIn <> "" Then
    ' Remove initial comma
    strIn = Mid(strIn, 2)
    strWhere = strWhere & " AND [SomeField] In (" & strWhere & ")"
    End If
    If strWhere <> "" Then
    ' Remove initial " AND "
    strWhere = Mid(strWhere, 6)
    End If
    DoCmd.OpenReport ReportName:="rptMyReport", View:=acViewPreview, WhereCondition:=strWhere
    Exit Sub
    ErrHandler:
    If Err = 2501 Then
    ' Report cancelled - ignore
    Else
    MsgBox Err.Description, vbExclamation
    End If
    End Sub
    If SomeField is a text field instead of a number field, change the line
            strIn = strIn & "," & Me.lbxMulti.ItemData(varItm)
    to
            strIn = strIn & "," & Chr(34) & Me.lbxMulti.ItemData(varItm) & Chr(34)
    Regards, Hans Vogelaar (http://www.eileenslounge.com)

  • 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

  • How to un-check everything in a Multi-selection list box in SP2013?

    When a radio button is selected/un-selected, i would like to clear all the checkboxes that were checked in a MSLB.  I created a rule for the condition but in the action, how to create this uncheck action?
    Thank you

    yes, that's what I've done but still not working.  I even downloaded the sp, 
    InfoPath 2013 (KB2837648) 32-Bit Edition
    and it still doesn't work.  In the screen shot attached, ml prefix is for Multi-selection list box.  So, in mlImprovement, if the Communication checkbox isn't checked then set the Multi-selection list box, Communicaiton, to blank so it should
    show no selection.
    In the preview of Infopath 2013, I would check Communication in mlImprovement and then check a couple of checkboxes in mlCommunicaiton.  I then uncheck and check Communicaiton in mlImprovement and those previously checked checkboxes remains.
    I have been very frstrated working the MLSB infopath 2013.  there are other issues that does't work either.  Please advise if I'm missing a step here and there, thank you.

  • Upgrade to 10.1.3.4: Problems with multi-select list

    Hi,
    We upgraded from BiseSEone (10.1.3.2) to 10.1.3.4 (using BI EE). One of the features we were longing for was the improved multi-select list in the dashboard prompts (with a efficient search support). But after the Installation the multi-select list doesn't work at all. There are no data offered and the frames are missing. What could be go wrong here ? There were no problems during the installation. I told the installation to keep the configurations.
    regards
    Thomas
    Hi guru's,
    is there anybody around who experienced a similar phenomenon !!!
    regards
    Thomas
    Edited by: tdombrow10 on Jun 7, 2009 10:04 PM

    unfortuantely(i beleive i had the same problem)
    you have to rebuild them
    i hope i helped....
    http://greekoraclebi.blogspot.com/
    ///////////////////////////////////////

  • 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

  • Multi Selection List...

    Hi Everyone,
    In one of my form i want to put 2 multi selection lists, Like user selecting data from one list and when he clicks button the selected items from the first list moves to the second list. user should also be able to doubl click and select the items indivisually. Similary the other list should also behave in the same way.
    How is this thing possible in Developer 6i. Is there any source code help to develop this kind of lists? Or any sample form? Or someone can send me the code how to implement such kind of technique in forms. please help!!
    Kind Regards,
    Imran Baig
    [email protected]

    Check the standard Forms 6i features and benefits demos for such a sample. You can download the code from the samples section of OTN.

  • Populate multi select list  in on demand application process

    Hi all,
    To populate a multi select list we use this code:
    DECLARE
    l_counter number;
    l_o_name varchar2(2000);
    l_val varchar2(100);
    BEGIN
    l_val := wwv_flow.g_x01;
    owa_util.mime_header('text/xml', FALSE );
    htp.p('Cache-Control: no-cache');
    htp.p('Pragma: no-cache');
    owa_util.http_header_close;
    htp.prn('<select>');
    FOR rec IN (
    SELECT DISTINCT DECODE(districtscode,NULL,'- Onbekend -',districtscode) as "NAME"
    , DECODE(districtscode,NULL,'-2',districtscode)as "ID"
    FROM table
    WHERE (UPPER(dienstcode) =(l_val)
    or l_val = '-1')
    and objectsubcategorie_id in (select objectsubcategorie_id from table where ind_actief = 'J')
    and ind_uitgesloten is null
    UNION
    SELECT '- Alle districten -', '-1'
    FROM DUAL
    ORDER BY 1
    LOOP
    htp.prn('<option value="' || rec.ID || '">' || rec.NAME
    || '</option>');
    END LOOP;
    htp.prn('</select>');
    END;
    However: L_val is determined by a multiselect list. So, L_id can be: 'A:B:C'. I can convert the value of l_id to 'A','B','C' (with eg replace function). However in a where clause one cannot say: WHERE UPPER(dienstcode) in l_val. So I created a refcursor which I put in a pl/qsl table. Then I looped through the pl/sql table.
    Somehow this did not have the same results. Eventhough the refcursor gave back the same data which I tested by logging the values of the pl/sql table just before the htp.prn command, the htp.prn did not return the values.
    Does anyone know why this happens? Is there a difference between the for loop in this code and looping through a self defined pl/sql table?
    Thanks in advance
    Maurice

    Please, anybody could help me with this?
    Thank you!

  • How to make multi select list as dropdown??

    Hi friends,
    using apex 4.0
    i want to make multi select list as dropdown,how can i do this??
    thanks in advance.. :)

    mn123 wrote:
    using apex 4.0You MUST include the following information with every question:
    <li>Full APEX version
    <li>Full DB version and edition
    <li>Web server architecture (EPG, OHS or APEX listener)
    <li>Browser(s) and version(s) used
    <li>Theme
    <li>Template(s)
    <li>Region/item type(s)
    This cuts down on the need for a lot of follow-up questions or second-guessing. Appropriate solutions may differ according to any of these variables.
    i want to make multi select list as dropdown,how can i do this??Please define exactly what you mean by "multi select list" and "dropdown".
    Do you mean displaying a multi-select enabled select list as a drop-down list rather than as a list box? If so, this is not possible using standard APEX/web browser controls.

  • Reporting on a Multi-Select list field X:Y:Z

    I'm sure someone must have come across this problem but I can't find a reference to it on the forum.
    PROBLEM
    I have a data entry form with multi-select lists. Users choose a number of display values and the return values are stored in the field in the format
    20:30:50
    When I create an SQL report on a row, there is no option to Display the column as a "multi-select list" like there is with a standard List of Values.
    How do I report the display lookup values rather than the return code?
    Is it possible to display the selected values in a report for example
    red
    orange JOHN 10-JAN-07
    green
    red
    orange MARY 12-FEB-07
    orange
    green MARK 13-JUL-07
    regards
    Paul P

    Paul,
    I have several examples on this topic:
    http://htmldb.oracle.com/pls/otn/f?p=31517:87
    http://htmldb.oracle.com/pls/otn/f?p=31517:84
    http://htmldb.oracle.com/pls/otn/f?p=31517:75
    Basically, you will need to create a table out of your colon separated values and then
    join this table with other tables to be able to display it however you want.
    What just comes to my mind is that Dietmar presented a nice workarround for a similar
    problem here:
    Nested report howto?
    Denes Kubicek

  • On button click of Infopath forms select multi select list box values...

    Hi,
    We have multi select list box on one of the info path forms. We have placed on button on this form. If user clicks on this button we want to select some of the values in Multi select list box (check box).
    Is it possible if yes how can we achieve it?
    Thanks.
    Regards,
    Amit Chhatbar

    Hi Amit,
    From your description, you would like to check items in a multi-selection box when a button is clicked.
    I’d recommend you make use of rules in InfoPath form, i.e. when button is clicked, then set a field’s value.
    However, if you are using multi-selection box, then you could only set the value of one item at a time. If you want to select several items at once, then we could use code. For more information:
    http://www.bizsupportonline.net/blog/2009/07/understanding-multiple-selection-list-box-infopath/
    http://www.bizsupportonline.net/infopath2007/programmatically-select-all-items-multi-select-list-box.htm
    If you are using several check boxes to replace multi-selection box, then it will be more easy. The rule could be that when this button is clicked, set a field’s value (check box field) to true and repeat it.
    Regards,
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected] .
    Rebecca Tu
    TechNet Community Support

  • Multi-select lists, their return values and showing their display value

    I have a multi select list which is dynamic. The display and return values are pulled from a table where the return value is the Primary Key.
    When people select a few options, the value is stored in session state as 11:12:13 (etc...). From here, I run these numbers through a process which takes a report ID and the multi-select string, and saves individual rows as Report_id, individual multi select value until there are no more multi select values.
    This is great, they're tied in as a foreign key to the LOV lookup table, and they are easily search able.
    I have trouble where I want to list a report's entire multi-select list. I have a function combine the numbers with a : in between them and RTRIM the last one, so I have an identical string to what a multi-select table uses. 11:12:13 (etc..)
    When I assign it to display as an LOV in a report, it just shows the 11:12:13 instead of listing out the values.
    Single number entries, where someone only selected one option in a multi select, display fine.
    Am I doing this wrong?

    Scott - you're right on the money. I did this initially because I thought assigning an LOV display value to a report column would yield the results I wanted.
    I want to do this without referring to the original table... meaning I don't want a function to have to go out and get the names, I'd like my LOV assignment to do it. This saves headache of having to change something in 2 places if it ever changed.
    Am I not going to be able to do this?
    I created a test multi-LOV page, it doesn't work with original(not processed in my function) LOV assignments either, unless you only select one.

  • Select multiple values in mult-select list

    I have the following query as the source for a multi-select page item:
    SELECT person.person_id
    FROM person, pers_proj_task
    WHERE pers_proj_task.person_id = person.person_id
    AND pers_proj_task.project_id = :P3_PROJECT_ID
    The query returns two records and the page item's session value is 4:3, but only the value 4 is highlighted in the mulit-select list. How can I get both values to be highlighted?

    Got it to work for a multi-select item by following Dimitri's post which uses a shuttle example. It was still only highlighting one value, but I tried Patrick Wolf's suggestion from the comments on Dimitri's post to put the pl/sql block in the source of the item rather than as a computation and it worked.
    So I now have a multi-select list which has default values pulled from a LOV. The items that are highlighted by default are selected by using the following pl/sql block in the "source/value or expression" of the :P3_PERSON_ID multi-select item:
    declare
    person_list apex_application_global.vc_arr2;
    i number := 1;
    begin
    for r in ( SELECT person.person_id
    FROM person, pers_proj_task
    WHERE pers_proj_task.person_id = person.person_id
    AND pers_proj_task.project_id = :P3_PROJECT_ID)
    loop
    person_list(i) := r.person_id;
    i := i + 1;
    end loop;
    return APEX_UTIL.TABLE_TO_STRING(person_list,':');
    end;
    Thanks to Amanda, ArtS, Dimitri and Patrick.
    Jeremy

  • Multi-select list to select with in clause

    I have a multi-select list that the user can select from. P200_NODE_SELECTION.
    I take the value(s) of that list and parse them out in a process using this code:
    declare
    l_selected HTMLDB_APPLICATION_GLOBAL.VC_ARR2;
    v_char varchar2(2000);
    begin
    l_selected:=HTMLDB_UTIL.STRING_TO_TABLE(to_char(:P200_NODE_SELECTION) );
    for i in 1..l_selected.count
    loop
    if i=1
    then
    :P200_LIST_OF_NODES:=to_char(l_selected(i) );
    else
    :P200_LIST_OF_NODES:=to_char(:P200_LIST_OF_NODES)||','||to_char(l_selected(i) );
    end if;
    end loop;
    end;
    This PL/SQL is trying to create the in-list string to be used in as the LOV to populate another select list. The LOV query for the second multi-select list looks like this:
    select instance_name DISP, instance_id RET
    from instance
    where to_char(node_id) in (:P200_LIST_OF_NODES)
    I've tried this a couple of different ways. Without the to_char in the where clause (a terrible thing to do to a query I know) I get a numeric conversion error.
    When I do it with the to_char, it works if I select one record in the multi-select list, but if there are more than one then the in list fails.
    I'm sure there must be a better way to do this (or at least a way that works!).... anyone want to help me here?

    Robert - Try  where instr(','||:P200_LIST_OF_NODES||',',','||to_char(node_id)||',') > 0...and do get rid of all those to_chars in the process.
    Scott

  • Multi-Select List box selection as an array

    On a JSP Search page I have a multi-select list box
    \<select name="searchCampusMulti" size="4" multiple>
    <c:forEach var="listEntry" items="${bindings.CampusCodeView1.rangeSet}">
    <option value="<c:out value='${listEntry.CampusCode}'/>">
    <FONT face="Times New Roman" size="2">
    <c:out value="${listEntry.CampusNameShort}"/>
    </FONT>
    </option>
    </c:forEach>
    </select>
    How do I pass the selected values as an array to a method in a DataAction?
    Please give me the step by step run through
    Any help is appreciated
    Thanks

    Hi,
    didi you check teh request object for a request parameter "searchCampusMulti" ?
    Frank

Maybe you are looking for

  • Sy-tabix Pboblem ?

    Before this loop sy-tabix becomes 17 . and when sy-subrc is 0 instead of deleting the first line it deletes the 17th. CLEAR: SY-SUBRC,SY-TABIX.   SORT: IT_FINAL, IT_TE, IT_TEM." BY VBELN POSNR.   DELETE ADJACENT DUPLICATES FROM IT_TE  COMPARING VBELN

  • HP LaserJet Pro 200 MFP Loud noise + grinding

    This is my second HP Printer ( exact same one). After using it quite often for over 8 months the printer starts out by printing 2 completely black pages before printing the desired document. This will repeat if the printer sits for more  than 15 minu

  • Custom abap report on payload

    Hi I want to develop a custom abap report  in XI on the basis of payload. Any clues?????????? Regards Vijay

  • Lightroom cannot create files in the temporary file location

    I changed some collection setting and can not open LR3 any more. Help!

  • Messages: Broken links when sending from Mac to iOS

    If I copy a link from Safari (right-click > Copy link) and send it with Messages on Mac it remains a clickable link with a link text (in the chat window). The problem is if the recipient uses Messages on iOS he will only see the link text and cannot