Home » Developer & Programmer » Forms » POPULATE LIST ELEMENT FROM A RECORD GROUP
POPULATE LIST ELEMENT FROM A RECORD GROUP [message #78562] Sun, 03 March 2002 13:36 Go to next message
ceycey
Messages: 22
Registered: February 2002
Junior Member
I could not manage to create a record group at runtime. I will use these values in a list item.As far as I know, I have to create some record groups at runtime,then I have to populate the list elements from that record group. I have a trigger with the code below:
DECLARE
rg_name VARCHAR2(40) := 'TEST';
rg_id RecordGroup;
gc_id GroupColumn;
errcode NUMBER;
BEGIN
rg_id := Create_Group(rg_name);
gc_id := Add_Group_Column(rg_id, 'ATA',NUMBER_COLUMN);
gc_id := Add_Group_Column(rg_id, 'TAT',NUMBER_COLUMN);
END;

But I have the following messages
FRM - 41072 (can't greate record group..)
FRM - 41079 (can't add columns..)
What is the point to create a record group and populate a list item with that?
Thanks....
Re: POPULATE LIST ELEMENT FROM A RECORD GROUP [message #78565 is a reply to message #78562] Sun, 03 March 2002 21:22 Go to previous messageGo to next message
Remash
Messages: 52
Registered: November 2000
Member
When you run the program, first time the record group is created. 2nd time it tries to create the same record group resulted in FRM - 41072 error. Instead of creating the record group each time, check whether the same name exists. The following codes will rectify the problem.

BEGIN
/*
** Make sure the record group does not already exist.
*/
rg_id := Find_Group(rg_name);
/*
** If it does not exist, create it and add the two
** columns to it.
*/
IF Id_Null(rg_id) THEN
rg_id := Create_Group(rg_name);
gc_id := Add_Group_Column(rg_id, 'ATA',NUMBER_COLUMN);
gc_id := Add_Group_Column(rg_id, 'TAT',NUMBER_COLUMN);
END IF;
END;

--------------
Regards
Remash Babu
Re: POPULATE LIST ELEMENT FROM A RECORD GROUP [message #78569 is a reply to message #78562] Mon, 04 March 2002 01:40 Go to previous messageGo to next message
sethu
Messages: 9
Registered: May 1999
Junior Member
cecey,
I have another alternative.
create a program unit as follows
------------------------------------------------------
PROCEDURE st_poplist (plist in varchar2,pgroup in varchar2) IS
err_flag number:=0;
list_pop_problem exception;
BEGIN
err_flag:=populate_group(pgroup);
if err_flag=0 then
clear_list(plist);
populate_list(plist,pgroup);
elsif err_flag=1403 then
null;
else
raise list_pop_problem;
end if;
EXCEPTION
WHEN OTHERS THEN
MESSAGE('Exception: Could Not populate ' ||plist||'
with the query in group'||pgroup||'.');
END;
--------------------------------------------------
Then, in the WHEN-NEW-FORM-INSTANCE, call this procedure as follows.
----
st_poplist('LIST_ITEM','RECORD_GROUP');
---------- where LIST_ITEM is a non database list item and RECORD_GROUP is the one as follows
-------------
select distinct ITEM_DESCRPTION,ITEM_CODE from USER.MASTER_TABLE order by 1
------------------------
Then in the LIST_ITEM -->WHEN-LIST-CHANGED trigger type
--------------------
:LIST_ITEM:=:ACTUAL_DATABASE_ITEM
-----------------------------------
and in the POST-QUERY trigger type
-------------------------------------
select ITEM_CODE into :LIST_ITEM from USER.MASTER_TABLE where ITEM_CODE=:ACTUAL_DATABASE_ITEM;
------------------------------------------
That's it. Get back to me for further doubts
Re: POPULATE LIST ELEMENT FROM A RECORD GROUP [message #78583 is a reply to message #78562] Mon, 04 March 2002 12:54 Go to previous messageGo to next message
ceycey
Messages: 22
Registered: February 2002
Junior Member
Thank you all for help. My list elements are being populated just like I designed. Thanx.

Regards.
ceycey
Re: POPULATE LIST ELEMENT FROM A RECORD GROUP [message #202820 is a reply to message #78569] Sun, 12 November 2006 23:48 Go to previous message
pathic0477
Messages: 8
Registered: May 2005
Location: Indonesia
Junior Member
sorry i'm newbee,

what mean at :list_item = :actual_database_item ?

if in my form list_item = :cus_booking.idclient, record group = select distinct client, idclient from cus_client order by 1.

thanks
Previous Topic: I want the timestamp of FMX
Next Topic: what is wrong with this code?
Goto Forum:
  


Current Time: Tue Dec 06 12:05:27 CST 2016

Total time taken to generate the page: 0.11848 seconds