Re: Populating a pop-list with a coloumn from a table, on Forms 4.0

From: Steve Johnson <robertoc_at_fyiowa.infi.net>
Date: 1997/08/07
Message-ID: <33E9DDD7.46E2_at_fyiowa.infi.net>#1/1


naheed wrote:
>
> I want to have the entries from a coloumn in a table populate a pop-list.
> It doesn't sound that difficult.......
>
> 1) I've made a record group with two columns that are the same.
> 2) I've placed a list down on the form.
>
> I think i need to create a trigger to execute "populate_list", but all the
> triggers that I've tried have not worked. This is the layout of the
> trigger i have been using:
>
> Declare
> list_id Item := Find_Item('the_list');
> recgrp_id RecordGroup := Find_Group('the_recgrp');
> Begin
> do_key( 'Populate_List(list_id, recgrp_id)' );
> End;
>
> If I attach this text to a when-button-pressed trigger, in run-time i get
> the message:
> FRM-41004: Function key not allowed in this mode.
>
> If I remove do_key from the trigger i get this message if i compile the
> text
> Error 313 Populate_list not declared in this scope.
>
> So, how do i get the values form the record group into the pop-list?
>
> Thanx, Nahaad's friend.

Your second choice should work (Populate_list). If you only need to populate it once and the values always stay current then you probably want to populate it in a when-new-form-instance trigger or something similar. Here's a procedure which I use. The list_id and the SQL Statement are passed in.

PROCEDURE populate_the_list (list_id item, sql_stat varchar2) IS   group_id recordgroup;
  outcome number;
begin
  group_id := create_group_from_query('list_elements',sql_stat);   IF id_null(group_id) then
    message('error');
    raise form_trigger_failure;
  end iF;
  outcome := populate_group(group_id);
  IF outcome <> 0 then
    message('error in pop');
    raise form_trigger_failure;
  ENd IF;

  populate_list(list_id, group_id);

  delete_group(group_id);
END; Received on Thu Aug 07 1997 - 00:00:00 CEST

Original text of this message