Re: Forms 4.5 Questions!
Date: 1997/10/15
Message-ID: <876938551.22367_at_dejanews.com>#1/1
In article <34423294.3D13CB0D_at_MUOhio.Edu>,
Dean Harris <HarrisDE_at_MUOhio.Edu> wrote:
>
> I have a couple questions for forms.
>
> First, how does one populate a list item from a database table? We
want
> look up codes to be list items and dynamically populated from a
database
> table. I have attempted to do this with a trigger (using a cursor
and
> ADD_LIST_ELEMENT), but I get a error during generation unless I
include
> at least one element in the list thru the properties. Kind of
defeats
> the purpose of dynamically inserting elements.
. . .
>
> Any help would be greatly appreciated.
>
> Thanks,
> Dean Harris
> Miami University
> Oxford, OH
Try Something Like This:
PROCEDURE FILL_TYPE_LIST IS
GRP_ID RECORDGROUP;
LIST_ID ITEM;
GRP_NAME CHAR(15);
ERR_CODE NUMBER;
BEGIN
GRP_NAME:= 'TYPE_GRP'; GRP_ID := FIND_GROUP(GRP_NAME); LIST_ID := FIND_ITEM('DETAIL_BLK.ITEM_TYPE');
IF ID_NULL(GRP_ID) THEN
GRP_ID := CREATE_GROUP_FROM_QUERY('TYPE_GRP', 'SELECT
ITEM_TYPE,'||
'TO_CHAR(ITEM_NO) FROM R_DYAD_ITEM_TYPE');
END IF;
DELETE_GROUP_ROW('TYPE_GRP', ALL_ROWS);
IF (POPULATE_GROUP('TYPE_GRP') = 0) THEN
CLEAR_LIST(LIST_ID);
POPULATE_LIST(LIST_ID, GRP_ID);
END IF;
END;
Where The Second Entry in your select statement is the
value for the item and the first is the label.
Robert Kelman <robbk_at_kelman.com>
-------------------==== Posted via Deja News ====----------------------- http://www.dejanews.com/ Search, Read, Post to UsenetReceived on Wed Oct 15 1997 - 00:00:00 CEST