Re: [DEVELOPER/2000] COMBO BOX....

From: Sorokin Anton (Moscow) <"Sorokin>
Date: Tue, 22 Feb 2000 10:00:56 +0300
Message-ID: <88tcb3$prb$1_at_pechkin.menatep.spb.ru>


peter <misybh_at_hmc.com.tw> сообщил в новостях следующее:38B1FFFC.C81432E4_at_hmc.com.tw...

> HI...

> how to set combo box's source is from a table?
> I want to change it's list-value dynamically...how?
> Thanks.
Hi ! (sorry for my english) 1) Make the Text Item on the Block. Properties /Item Type = List
Item

/List Stile = Poplist or Combo Box.

2) Uour need to fill data into the Combo box:

  • when Form is starting: Triggers / WHEN_NEW_FORM_INSTANCE
  • when working any trigger: To open cursor on needed table.
    1. Example:

clear_list('TEXT_ITEM1');

ADD_LIST_ELEMENT('TEXT_ITEM1',1,'word1','word1');
ADD_LIST_ELEMENT('TEXT_ITEM1',1,'word2','word2');
ADD_LIST_ELEMENT('TEXT_ITEM1',1,'word3','word3');
:BLOCK1.TEXT_ITEM1 := 'word2';

If uour want to dsiplay values fetched by a query:

b) Uour kan to include the procedure ADD_LIST_ELEMENT into the cycle or cursor.

 Example:

declare

cursor curCUR is
  select ID from MT where substr(ID,1,3) in ('303','304') order by ID desc;

cCUR varchar2(20);

begin

open curCUR;

   clear_list('TEXT_ITEM1');

     loop
       fetch curCUR into cCUR;
       exit when curCUR%NOTFOUND ;
       ADD_LIST_ELEMENT('TEXT_ITEM1',1,cCUR,cCUR);
    End loop;
Close curCUR;

ADD_LIST_ELEMENT('TEXT_ITEM1',1,'3030108','3030108'); End;

c) Uour can to use function "Populate_List"

  Example:

declare

 w1                  number;
 cSQLQuery  varchar2(2000);
 name1           varchar2(40) := 'Word1';
 rg1                 RecordGroup;
 It1                   item := Find_Item('LIST_BOX1');

Begin

cSQLQuery := 'select ID, Name, Amount from MT order by ID'; rg1 := CREATE_GROUP_FROM_QUERY(name1, cSQLQuery);

if Id_Null(rg1) then
  w1 := Show_Alert('Alert7');
 end if;

if Populate_Group(rg1) !=0 then
  w1 := Show_Alert('Alert7');
end if;

Populate_List(It1, rg1);

 go_block ('BLOCK_MT');
 execute_query;

end;



With best regards
Sorokin Anton Received on Tue Feb 22 2000 - 08:00:56 CET

Original text of this message