Dynamic Record Group [message #79475] |
Thu, 13 June 2002 03:36  |
sarma
Messages: 6 Registered: November 1998
|
Junior Member |
|
|
Hi,
I would like to know how to create and populate record
groups dynamically at runtime?
If anyone explains me with an example that would be
great helpful to me.
Thanks in advance.
Regards,
Sarma
|
|
|
Re: Dynamic Record Group [message #79479 is a reply to message #79475] |
Thu, 13 June 2002 07:03   |
Raymond
Messages: 30 Registered: September 2000
|
Member |
|
|
Here goes a short example:
Suppose you have to populate a list dynamically,by selecting from a master.
Then create a list item, say, emp_list_name, in a emp_detail_block.
This list has to be populated from the emp master table.
Put the following code in pre-block/pre-form trigger.
This populates the list.
=======================================================
DECLARE
rg_id RecordGroup;
errcode NUMBER;
BEGIN
if id_null(rg_id) then
rg_id := CREATE_GROUP_FROM_QUERY('REC_GRP','select emp_name,emp_name from emp_master');
errcode := Populate_Group(rg_id);
IF errcode = 0 THEN null;
ELSE
Message('Error creating query record group');
RAISE Form_Trigger_Failure;
END IF;
Clear_List('emp_detail_block.emp_list_name');
Populate_List('emp_detail_block.emp_list_name',rg_id);
end if;
END;
=======================================================
There are other built ins available for adding and deleting to the list dynamically.
caveats:
++++++++
1. I do not know why we need to give at least 2 items in the select. It is not working if i give a single item.Hence, I have repeated emp_name twice.
|
|
|
|
|