Dynamic values of a select list based on a column

Is there an easy way to build the values of a select list from a column that contains 'Red,Green,Blue" where Red, Green, Blue will be the values of the select list?

Bob,
Next time you could try this for a one row table:
WITH DATA AS
     (SELECT     SUBSTR (txt
                        , INSTR (txt, ',', 1, LEVEL) + 1
                        ,   INSTR (txt, ',', 1, LEVEL + 1)
                          - INSTR (txt, ',', 1, LEVEL)
                          - 1
                        ) AS token
      FROM       (SELECT ',' || YOUR_COLUMN || ',' txt FROM YOUR_TABLE)
      CONNECT BY LEVEL <=
                      LENGTH (txt)
                    - LENGTH (REPLACE (txt, ',', ''))
                    + 1)
SELECT *
FROM   DATAOr use this if your comma separated values are in more than one row:
http://blogs.ittoolbox.com/oracle/guide/archives/sql-question-pivots-analytics-and-the-judicious-use-of-row_number-10156

Similar Messages

  • Dynamically change the value of a select list in form based on a table

    Hi Friends,
    I am using a form based on a table. I want to display two fields as select lists instead of text boxes and when a value
    in a select list is selected, the corresponding values will be listed in the next select list. For example if department
    value is selected in a select list the employees in that department will be listed in the employee select list. I saw a
    metthod using ajax for achieving this in tabular form in Denes's sample application[Click Here| http://apex.oracle.com/pls/otn/f?p=31517:176:462842537250908::NO] .
    Is there any way to achieve the same for a form based on a table,
    Thanks,
    Tj

    Hi Andy,
    Could you tell me how I could use your example with multiple Application Items?
    My page has 3 cascading select lists. The second is dependent on the first and the third is dependent on both the first and second. I thought I would just need to add the second application item as a get, but not sure what the syntax would be. I have troubleshooted to the point where my select list refreshes when I have one in the javascript...just not sure how to add the additional one?
    Here's what I have (I have been referencing your 'Get Employees' page)
    My Page Items:
    P0_VENDOR_ID
    P0_VENDOR_SITE_ID
    P0_INVENTORY_ITEM_ID
    My Application Items:
    F_VDR_ID
    F_VDR_SITE_ID
    My query in the application process has both F_VDR_SITE_ID and F_VDR_ID in it.
    My javascript function...this worked OK until I added the additional get.add('F_VDR_SITE_ID')
    function getItems(filter, listName)
    var xml = null;
    var list = document.getElementById(listName);
    var listvalue = list.value;
    var get = new htmldb_Get(null,$v('pFlowId'), 'APPLICATION_PROCESS=Set_Items',4);
    get.add('F_VDR_ID', filter.value);
    get.add('F_VDR_SITE_ID', filter.value);
    ret = get.get('XML');
    if(ret)
    var s = ret.getElementsByTagName("select");
    if(s){
    var o = ret.getElementsByTagName("option");
    var oCount = o.length;
    list.options.length = 0;
    for(var i = 0; i < oCount; i++){
    var l_Opt_Xml = o;
    appendToSelect(list, l_Opt_Xml.getAttribute('value'), l_Opt_Xml.firstChild.nodeValue);
    list.value = listvalue;
    if (list.selectedIndex == -1)
    list.selectedIndex = 0;
    get = null;
    Thanks,
    Janel

  • Creating a dynamic Selection List based on a View Object

    Hello,
    I'm new to JDeveloper and I would like to create a JSP Page with dynamic Selection List based on a runtime query or based on a view object (BC4J). The selection made by an user should serve another dynamic query with the necessary parameters that I built using createViewObjectFromQueryStmt(). By now I tried this using the InputSelectLOV from the Component Palette in JDeveloper. But without success. By the way: the selection list is not very large (5 values), so it's not necessary to have a form finding the desired value.
    Maybe someone had experience about creating this already. Please give me a tip or a little example.
    Thanks.

    http://otn.oracle.com/products/jdev/howtos/jsp/renderers.html

  • Select list based on LOV - and allowing new values

    Hi All,
    I have a page that has a select list based on a dynamic list of values. I wanted to test out how the system was working, so I truncated all of my tables, and now my select list is blank (which makes sense). The problem is that I can't type anything into the select list. How can I make it so that if there isn't a value returned from the query that populates the LOV, I can just type one in? This also goes further in that if the value I wanted isn't already in the db, how does the user add in another value?
    Thanks in advance,
    Corey

    Hello,
    Well as you now know HTML based select lists don't work like that, that widget is called a combo box and there will be built in combo boxes in APEX 3.0, it's a fairly complex dhtml widget.
    What you might want to do is provide a text item next to your select box and an Add New Value Option in your select list.
    Carl

  • Dynamic Select List based on TextField data

    Hi,
    I like to dynamically display the select list based on the value in the textfield, the data in the textfield is of character type.
    Thanks

    Hello,
    Well as you now know HTML based select lists don't work like that, that widget is called a combo box and there will be built in combo boxes in APEX 3.0, it's a fairly complex dhtml widget.
    What you might want to do is provide a text item next to your select box and an Add New Value Option in your select list.
    Carl

  • Based on select list, i need to retrieve values in other select list

    Hi,
    am new to apex using apex3.2, i need to retrieve values in select list based on the other select list vale with out refreshing page.
    ie i have region select list and country select list,in country corresponding region country must be display but with out refreshing page.
    can you please any body guide me.
    Regards
    shashidhar
    Edited by: 871140 on Jul 7, 2011 10:34 PM

    Hi,
    you can use cascading LOV for that, i which the other LOV field will be changing depending upon the selection of other value(which is in LOV).
    http://www.inside-oracle-apex.com/oracle-apex-4-0-cascading-lovsselect-lists/
    Regards,
    Mini
    Mark Answers Promptly

  • Problem writing a sql query for a select list based on a static LOV

    Hi,
    I have the following table...
    VALIDATIONS
    ID          Number     (PK)
    APP_ID          Number     
    REQUESTED     Date          
    APPROVED     Date          
    VALID_TIL     Date
    DEPT_ID          Number     (FK)
    I have a search form with the following field item variables...
    P11_DEPT_ID (select list based on dynamic LOV from depts table)
    P11_VALID (select list based on static Yes/No LOV)
    A report on the columns of the Validations table is shown based on the values in the search form. So far, my sql query for the report is...
    SELECT v.APP_ID,
    v.REQUESTED,
    v.APPROVED,
    v.VALID_TIL,
    d.DEPT
    FROM DEPTS d, VALIDATIONS v
    WHERE d.DEPT_ID = v.DEPT_ID(+)
    AND (d.DEPT_ID = :P11_DEPT_ID OR :P11_DEPT_ID = -1)
    This query works so far. My problem is that I don't know how to do a search based on the P11_VALID item - if 'yes' is selected, then the VALID_TIL date is still valid. If 'no' is selected then the VALID_TIL date has passed.
    Can anyone help me to extend my query to include this situation?
    Thanks.

    Hello !
    Let's have a look at my example:create table test
    id        number
    ,valid_til date
    insert into test values( 1, sysdate-3 );
    insert into test values( 2, sysdate-2 );
    insert into test values( 3, sysdate-1 );
    insert into test values( 4, sysdate );
    insert into test values( 5, sysdate+1 );
    insert into test values( 6, sysdate+2 );
    commit;
    select * from test;
    def til=yes
    select *
      from test
      where decode(sign(trunc(valid_til)-trunc(sysdate)),1,1,0,1,-1)
           =decode('&til','yes',1,-1);
    def til=no
    select *                                                                               
      from test                                                                            
      where decode(sign(trunc(valid_til)-trunc(sysdate)),1,1,0,1,-1)
           =decode('&til','yes',1,-1);  
    drop table test;  It's working fine, I've tested it.
    The above changes to my first idea I did because of time portion of the DATE datatype in Oracle and therefore the wrong result for today.
    For understandings:
    1.) TRUNC removes the time part of DATE
    2.) The difference of to date-values is the number of days between.
    3.) SIGN is the mathematical function and gives -1,0 or +1 according to an negative, zero or positiv argument.
    4.) DECODE is like an IF.
    Inspect your LOV for the returning values. According to my example they shoul be 'yes' and 'no'. If your values are different, you may have to modify the DECODE.
    Good luck,
    Heinz

  • Populate SELECT LIST on selecting value in another SELECT LIST

    Hello
    I have two SELECT LIST's
    1. SELECT LIST with departments : Created a LOV which has all the departments.
    2. SELECT LIST with employees : This has to be dynamic.
    Based on the value from the first Department SELECT LIST I need to populate the Employee SELECT LIST.
    Please let me know, how can I do this.
    Appreciate your help
    thanks

    Hi,
    Say you have two form items P1_ITEM1, P2_ITEM2. You want the P2_ITEM2 will be updated according to the selection in P1_ITEM1. I am assuming P1_ITEM1 select list based on the department table. In the lov section for that item type dynamic query -
    select dept_id, dname from departments -- change attributes in query as per your table.
    set the null value -1 and default value -1 for P1_ITEM1. Change Display null to YES and type -Select dept in the null text.
    For P1_ITEM2 in the lov section type the following query for dynamic list -
    select emp_id, ename from employees where dept_id = NV(P1_ITEM1) or NV(P1_ITEM1) = -1 -- change attributes in query as per your table.
    for the second query assuming that you have dept_id as FK in the employees table. Make sure both fields are selected as select list as display. Now if user select the department from item1 it will update the item2. It will display all the employees if nothing is selected in the item1.
    Hope this helps,
    Thanks,
    M Tajuddin
    http://tajuddin.whitepagesbd.com

  • Select List (based on LOV) query problem

    Hello experts! I have a small problem here, which I can't seem to overcome.
    I have a page item (select list based on LOV), which is based on a query. The query returns all potential employees of a department that are responsible for a certain duty. So far so good!
    The problem is that there are two departments, which should not only see there own employees but also the name of the employee that has carried out a certain task. However, due to my query, the name of that person is not displayed - only the pk is returned.
    Do you have a recommendation how I display all employees of a specific department and have additional values translated as well?
    My query is as follows: select str_bearbeiter, cnt_bearbeiter from vt_tbl_bearbeiter where cnt_bearbeiter in (SELECT
    CNT_REGIERUNGSBEZIRK FROM TBL_REGIERUNGSBEZIRK) union select str_bearbeiter, cnt_bearbeiter from vt_tbl_bearbeiter where int_behoerde in (SELECT
    CNT_REGIERUNGSBEZIRK FROM TBL_REGIERUNGSBEZIRK where STR_REGIERUNGSBEZIRK = lower (:app_user)) whereas :app_user holds the information of the department.
    Any hint is appreciated!
    Many thanks,
    Seb

    Okay, I just had the right idea and it's working well! Sorry for posting!
    I return the name of the employee that has edited a dataset and simply add all others of the logged on department! Really easy! Should have thought of that before posting! ;-(
    The correct code is select str_bearbeiter, cnt_bearbeiter from vt_tbl_bearbeiter a, vt_tbl_punktdaten b where a.cnt_bearbeiter = b.int_bearbeiter and
    inv_pt_id_sub = :P4_PTIDS
    union select str_bearbeiter, cnt_bearbeiter from vt_tbl_bearbeiter where int_behoerde in (SELECT
    CNT_REGIERUNGSBEZIRK FROM TBL_REGIERUNGSBEZIRK where STR_REGIERUNGSBEZIRK = lower (:app_user))Bye,
    Seb

  • Order in a Select List based in a LOV is wrong

    I have a select list based upon a LOV SQL Query.
    Values in table are:
    FIELD
    001
    002
    003
    AAA
    when I make query in SQL Workshop:
    select FIELD from TABLE order by FIELD;
    I get
    001
    002
    003
    AAA
    But when I make a similar query in LOV the result is in the select list
    AAA
    001
    002
    003
    Someone knows what is happening?
    Thank
    Ander

    mhichwa wrote:
    It looks like your application is running a different sort / NLS preference then is the SQL workshop. Is there a chance your application identifies a language that sorts differently then default APEX. I am just guessing but it could explain this behavior.OK, I think something like this is happening because my Oracle instance have SPANISH like a NLS_LANG parameter, but why is different result between sql Workshop and LOV query, I have installed english and spanish languages in my apex instance, I get the same problem in both cases.
    Other curious think is that my min and max values are OK,
    for example
    BETWEEN: <select list 1> AND <select list 2>
    default value for <select list 1> is
    DECLARE
    exitvalue varchar2(10);
    BEGIN
    select min(FIELD) into exitvalue
    from TABLE
    return (exitvalue);
    END;
    I get 001
    default value for <select list 2> is
    DECLARE
    exitvalue varchar2(10);
    BEGIN
    select max(FIELD) into exitvalue
    from TABLE
    return (exitvalue);
    END;
    I get AAA
    But select list are ordered like
    AAA
    001
    002
    003
    I have based select list in a lot of different sql ways
    select FIELD from TABLE ORDER BY FIELD
    select FIELD from TABLE ORDER BY 1
    select FIELD from TABLE ORDER BY FIELD ASC
    select FIELD from TABLE ORDER BY 1 ASC
    Other extraneous think is that I use DESC order I get
    003
    002
    001
    AAA
    Thanks
    Edited by: user10999912 on 24-Jul-2010 08:07

  • SELECT LIST - with values after have values in other Select List

    My friends.
    I need a select list that is self - complemented, after being selected a value in another select list above.
    Can you help?
    pesquisar

    Good afternoon,
    Try this for the definition of your select list:
    select emp.emp_name as display_column,
           emp.emp_id as return_column
      from employees emp
    where emp.department = :P1_DEPT_NO
    order by emp.emp_name;This will look at the select_list called :P1_DEPT_NO, capture the value that is currently selected and then populate the EMPLOYEE select list based on the results. Just use a query like this as the one that defines your second select list.
    This seems to be a popular question. Search this forum for other information.
    Don.
    REWARDS: Please remember to mark helpful or correct posts on the forum, not just for my answers but for everyone! :)

  • How to Refer the Selected value in a Select List

    I have a page item which is a select list. I have a button in my region which when clicked will call a process. This process takes the current value of my page item as a parameter. However, when I select a value from the Select list and click on the button, the page item is still submitting the earlier value, it is not getting updated with the value I selected in the select list. Can someone tell me how I can get the page item value to be updated with the value I selected from the choice list? I tried calling a javascript function from the element attribute of this select list onchange="javascript:setValue(this);") and was trying to set the value of another hidden page item with the value of this select list but then the function is not getting called as well. My function code is something like
    function setValue(pThis)
    for (var i = 0; i < pThis.options.length; i++) {
    if (pThis.options[ i ].selected){
    result= pThis.options;
    html_GetElement('P2_HIDDEN').value = result;
    P2_HIDDEN is my hidden page item

    970829 wrote:
    I have a page item which is a select list. I have a button in my region which when clicked will call a process. This process takes the current value of my page item as a parameter. However, when I select a value from the Select list and click on the button, the page item is still submitting the earlier value, it is not getting updated with the value I selected in the select list.
    How do you know this? Have you used Debug mode to track what is happening when the button is pressed? This will show any changes to item values in session state during page submit and page show processing.
    Can someone tell me how I can get the page item value to be updated with the value I selected from the choice list?
    This should happen automatically with a select list item, if the button is correctly defined to perform a page submit. It will not happen if the button performs a redirect. What action is defined to occur when the button is pressed?
    I tried calling a javascript function from the element attribute of this select list onchange="javascript:setValue(this);") and was trying to set the value of another hidden page item with the value of this select list but then the function is not getting called as well. My function code is something like
    function setValue(pThis)
    for (var i = 0; i < pThis.options.length; i++) {
    if (pThis.options[ i ].selected){
    result= pThis.options;
    html_GetElement('P2_HIDDEN').value = result;
    P2_HIDDEN is my hidden page item
    As detailed above, this should be completely unnecessary, however as an aside, html_GetElement is a very out of date method of accessing an item. What version of APEX are you using? (Always specify which version you're using when you ask a question, to allow us to determine the most appropriate solution to the problem.)

  • How to default a value in a select list

    Hi
    I have an item on the page which is displayed as a select list.
    The select list has an lov that returns 3 values as follows:
    ACAD1M
    ACAD2H
    ACAD3T
    the sql for this lov is as follows:
    select CAL_TYPE d,cal_type r
    from igs_ca_type
    where s_cal_cat='ACADEMIC'
    It needs to return the values in the order as shown above, however if the user does not select anything from the select list, I want it to default to the value in the middle of the list(ACAD2H)
    I tried using default on the item but I could not get this to work.
    Could someone explain how I can get the select list in HTMLDB to default to the value that I want regardless of which position it appears in the select list it always seems to default to the value at the top of the list.

    Hello Kay,
    A default value for a select list must be set to a legitimate returned value from the select list LOV query.
    The default value should be set in the item "Default" section. In the "Default Value" field you should enter your query – in a form of a PL/SQL Function Body – and set the "Default Value Type" field accordingly.
    The following is an example of code I'm using to set the default value of a select list to be the first displayed option (set by the user, and recorded in the dispord column):
    declare
      l_sno  number;
    begin
      select sno
      into l_sno
      from mis_mess_users
      where dispord = (select min(dispord)
                     from mis_mess_users);
      return l_sno;
    end;Using the same principle, you can use any query that will give you the result you need.
    Regards,
    Arie.

  • Accessing display values of a select list (or LOV)

    Hi all,
    I was asking myself if it is possible to access the display values of a select list (to be added to a report header and to the Head section of a pdf export),
    and to call them in form of the &xxxxx. notation
    e.g. if &P10_REGION. return the selected value (e.g. 1), I would like to have the corresponding display value (e.g. USA) .
    Kind regards,
    Boris

    Thank you Graham,
    unfortunately I'm a newbie regarding Javascript. Reading the APEX help, I could understand something but not everything.
    I would enter into the page html body the following script
    <script type="text/javascript">
    document.getElementById('P10_hiddenItem').value = document.getElementById('P10_referenceItem').text;
    </script>
    Is this the correct approach?
    how should I then submit the page?
    Thank you,
    Boris

  • How to display the display value of a select list

    I want to display the display value instead of the return value of a select list but don't know how to do it, can someone help me?

    When you created the select list item, you are ask to provide a list of values query which can either be a SQL query or a Static List, which both follows the pattern of
    Dispaly;Return.
    Example:
    SQL query -
    select 'Yes' col1, 'Y' col2
    from dual
    Static -
    STATIC:Yes;Y
    which will display 'Yes' but will actually, return 'Y'.
    how did you set your select list item?
    Thanks,
    Marilyn

Maybe you are looking for

  • Blank new hard drive can't install OS

    I replaced a hard drive in my 2010 Mac mini. The hard drive was formatted as a boot drive before I installed it. The drive had no operating system or files on it, I just used a formatting that allows it to be a bootable drive. I thought I would be ab

  • How can we call a OSB proxy service from a BPEL process?

    Hi, I want to call a OSB proxy service from a BPEL process. Can you please explain me the procedure?

  • How to remove empty tags from a config file

    Hi all, I have a task where we need to run a Java program to remove tags which do not contain ny information from the config files. The format of the file is as under: <roleManager>      <providers>           <add name="AspNetSqlRoleProvider" b03f5f7

  • Backend query to configure do not send mail

    Hi, We need to configure workflow notification mailer in production instance: The plan of action is as follows: Change the mail_status to 'SENT' for all mails which are in queue. Update the personalised status for all users to 'DO NOT SEND MAIL' Sele

  • Personalization vs. Customization in Sales Online making field mandatory

    I am having some difficulty distinguishing between Personalization vs. Customization in the Oracle CRM Sales/Marketing Online. Specifically, I have asked to make the Job Title field on the Contact screen to be mandatory when filling out contact detai