4 Replies Latest reply: May 28, 2012 3:31 PM by Amatu Allah Neveen Ebrahim RSS

    Dynamically add more values to existing poplist

    797021
      greetings,

      instead of recreating a poplist is there a way to add an extra value on the existing poplist dynamically?
      (Please note that there are hard-coded values in the existing poplist that do not exist in any table)

      Thank you,
      D
        • 1. Re: Dynamically add more values to existing poplist
          François Degrelle
          Hello,

          See in the Forms Builder online help(F1) for the Add_List_Element() built-in.

          Francois
          • 2. Re: Dynamically add more values to existing poplist
            797021
            right infront of me... thank you
            • 3. Re: Dynamically add more values to existing poplist
              Great Awo' G'
              you may have query like this
              rg_country:=CREATE_GROUP_FROM_QUERY('rg_country', ' select '||'''' ||'<Please Select>'||'''' || 'country_name ,' || ''''||'FFF' ||''''|| ' country_code from dual union
              SELECT country_name, country_code FROM country_codes order by country_name');
              • 4. Re: Dynamically add more values to existing poplist
                Amatu Allah Neveen Ebrahim
                Hi

                Well i'd like to share with a sample code in...

                Implementing Dynamic List Items

                The procedure and trigger below illustrate how you can populate a list item programmatically at run time using a given SELECT statement.
                Note: The retrieved rows are transferred to the list item by way of a record group.
                PROCEDURE populate_list_with_query
                
                --Populates the given list item with the specified query.
                
                (p_list_item in VARCHAR2
                ,p_query in VARCHAR2)
                
                IS
                
                /* Name the record group after the list item (no block prefix). */
                
                cst_rg_name constant VARCHAR2(30) := GET_ITEM_PROPERTY(p_list_item,item_name);
                
                v_rg_id RECORDGROUP;
                
                BEGIN
                
                v_rg_id := FIND_GROUP(cst_rg_name);
                
                IF ID_NULL(v_rg_id) THEN
                
                v_rg_id := CREATE_GROUP_FROM_QUERY(cst_rg_name,p_query);
                
                END IF;
                
                IF POPULATE_GROUP(v_rg_id) = 0 THEN
                
                POPULATE_LIST(p_list_item,v_rg_id);
                
                /* Force display of first list element label in the list item. */
                
                COPY(GET_LIST_ELEMENT_VALUE(p_list_item,1),p_list_item);
                END IF;
                
                END populate_list_with_query;
                When-Create-Record on the ORD Block
                BEGIN
                POPULATE_LIST_WITH_QUERY(’ord.customer_id’,’SELECT name, to_char(id) FROM s_customer ORDER BY name’);
                END;
                Note: In this example, the customer name is the (visible) list label and the customer ID is the (actual) list value.

                Hope this helps...

                Regards,

                Amatu Allah