Populate List Item [message #302768] |
Wed, 27 February 2008 00:02 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
mail2cmin
Messages: 3 Registered: January 2007
|
Junior Member |
|
|
Hi
I have coded the following at form level trigger to populate list item using record groups.But I am unable to succeed.
Pls go through the code and help me.
-----------------------------------------------------------------
/*
** Built-in: CREATE_GROUP_FROM_QUERY
**Example: Create a record group from a query, and populate it.
*/
DECLARE
list_id ITEM;
list_name VARCHAR2(40) := 'ENAME';
rg_name VARCHAR2(40) := 'Employee_Names';
rg_id RecordGroup;
errcode NUMBER;
outcome NUMBER;
BEGIN
/*
** Make sure group doesn't already exist
*/
list_id :=Find_Item(list_name);
rg_id := Find_Group( rg_name );
/*
** If it does not exist, create it and add the two
** necessary columns to it.
*/
IF Id_Null(rg_id) THEN
rg_id := Create_Group_From_Query( rg_name,'SELECT ENAME FROM EMP');
END IF;
IF Not Id_Null(rg_id) THEN
Message('Record Group Created');
END IF;
/*
** Populate the record group
*/
errcode := Populate_Group( rg_id );
IF errcode = 0 THEN
outcome := GET_GROUP_ROW_COUNT(rg_id);
Message(outcome);
END IF;
Retrieve_List(list_id, rg_id);
Clear_List(list_id);
Populate_List(list_id, rg_id);
END;
-----------------------------------------------------------------
|
|
|
Re: Populate List Item [message #302790 is a reply to message #302768] |
Wed, 27 February 2008 00:45 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
dillango
Messages: 145 Registered: January 2008
|
Senior Member |
|
|
Did you get any error message?
have you tried using this code?
populate_list('list_item','Recordgroup');
Where list_item is the item you created in the form and
the recordgroup will be associated with the list item.
Ilango
|
|
|
Re: Populate List Item [message #302800 is a reply to message #302790] |
Wed, 27 February 2008 01:09 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
dillango
Messages: 145 Registered: January 2008
|
Senior Member |
|
|
Are you getting an error FRM-41334 (invalid record group)?
As such the code is correct. Can you try to create in predefined record group (through object navigator) instead of this?
I tried several attempt but I could not succeed. I started using LOV.
Please let me know if you successfuly populate it in list item.
I think the experts Mr.David and Mr.Littlefoot have not gone through this.
Ilango
|
|
|
Re: Populate List Item [message #302806 is a reply to message #302800] |
Wed, 27 February 2008 01:16 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
mail2cmin
Messages: 3 Registered: January 2007
|
Junior Member |
|
|
Yes I have successfully done with the solution given by Vamsi Kasina.
It is a small change in the SELECT query.
Here it is......
-----------------------------------------------------------------
PROCEDURE Pop_List IS
/*
** Built-in: CREATE_GROUP_FROM_QUERY
**Example: Create a record group from a query, and populate it.
*/
list_id ITEM;
list_name VARCHAR2(40) := 'BLOCK3.item';
rg_name VARCHAR2(40) := 'Employee_Names';
rg_id RecordGroup;
errcode NUMBER;
outcome NUMBER;
BEGIN
/*
** Make sure group doesn't already exist
*/
list_id :=Find_Item(list_name);
rg_id := Find_Group( rg_name );
/*
** If it does not exist, create it and add the two
** necessary columns to it.
*/
IF Id_Null(rg_id) THEN
rg_id := Create_Group_From_Query( rg_name,'SELECT ENAME,ENAME FROM EMP',FORM_SCOPE,200);
END IF;
IF Not Id_Null(rg_id) THEN
delete_group(rg_id);
rg_id := Create_Group_From_Query( rg_name,'SELECT ENAME,ENAME FROM EMP',FORM_SCOPE,200);
END IF;
/*
** Populate the record group
*/
errcode := Populate_Group_with_query( rg_id,'SELECT ENAME,ENAME FROM EMP' );
IF errcode = 0 THEN
outcome := GET_GROUP_ROW_COUNT(rg_id);
Message(outcome);
END IF;
Clear_List(list_id);
Populate_List(list_id,rg_id);
END;
-----------------------------------------------------------------
|
|
|
Re: Populate List Item [message #302811 is a reply to message #302806] |
Wed, 27 February 2008 01:27 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
dillango
Messages: 145 Registered: January 2008
|
Senior Member |
|
|
Yes,
It is working fine. HOwever, my doubt is
why it is not working when we give populate_list('list_item','record group').
I have created the record group having selecting same column two times.
Ilango
|
|
|
Re: Populate List Item [message #330162 is a reply to message #302768] |
Fri, 27 June 2008 14:30 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
speeler
Messages: 3 Registered: June 2008 Location: USA
|
Junior Member |
|
|
I have used the pop_list procedure and it works great, but now the activity_date will not automatically populate and F10 will not save the data to the table.
Thank you for any help.
Steve
|
|
|
|