Home » Developer & Programmer » Forms » POPULATE LIST ITEMS FROM LIST ITEM VALUE
icon10.gif  POPULATE LIST ITEMS FROM LIST ITEM VALUE [message #146999] Tue, 15 November 2005 03:47 Go to next message
aarontan78
Messages: 63
Registered: August 2005
Member
Hi all,

I have a form which has 2 list items.
The first list item is populated from a table.
I would like to populate the second list item from the value I selected from the first list item.
Can someone please provide me with step by steps on how to do this?

Thanks in advance!

Regards,
Aaron
Re: POPULATE LIST ITEMS FROM LIST ITEM VALUE [message #147001 is a reply to message #146999] Tue, 15 November 2005 03:59 Go to previous messageGo to next message
ashishmate
Messages: 90
Registered: February 2005
Location: Mumbai
Member

Hi
use RETRIEVE_LIST and POPULATE_LIST built in for this you will have to create record group and then you can poulate the record group by using this buil in


eg.
Retrieve_List(list_id, 'RECGRP_ONE');
Clear_List(list_id);
Populate_List(list_id, 'RECGRP_TWO');
icon10.gif  Re: POPULATE LIST ITEMS FROM LIST ITEM VALUE [message #147007 is a reply to message #147001] Tue, 15 November 2005 04:10 Go to previous messageGo to next message
aarontan78
Messages: 63
Registered: August 2005
Member
Hi,

Thanks for the prompt reply. May I know where should I put these code? and where should i put my second populated record group code? and what is list_id?
If possible, can you show me the codes for doing this?
Basically this is my second populated record group code but it's not working..I need to have the value from the selected first list item to put into my second list item (record group) where clause.
DECLARE

	group_2 RecordGroup;
	list_2 Item := Find_Item('TABLE_2.FLD');
	status1 NUMBER;
	v_query varchar(1);

BEGIN
  group_2 := Create_Group_From_Query('FLD','SELECT FLD,FLD FROM TABLE_2 WHERE ID = :TABLE_1.ID');
  		Clear_List(list_2);
		status1 := Populate_Group('FLD');
		Populate_List(list_2,group_2);
  
END;

Regards...

[Updated on: Tue, 15 November 2005 20:36] by Moderator

Report message to a moderator

Re: POPULATE LIST ITEMS FROM LIST ITEM VALUE [message #147021 is a reply to message #146999] Tue, 15 November 2005 05:33 Go to previous messageGo to next message
ashishmate
Messages: 90
Registered: February 2005
Location: Mumbai
Member

hi

put this code in when validate item of your first list item or when new item instance of your second list

list id is name of list
declare
	  rg_id    RecordGroup;
	  n varchar2(10) := 'rg1';
	  gc_id    GroupColumn;
begin
	  rg_id := Find_Group( 'rg1' ); 
	    IF NOT Id_Null(rg_id) THEN 
	    	Delete_Group( rg_id ); 
	  	END IF;
	 	rg_id := Create_Group(n);
 		gc_id := Add_Group_Column('rg1', 'col1',CHAR_COLUMN,50 );
 		gc_id := Add_Group_Column('rg1', 'col2',CHAR_COLUMN,50 );

   Retrieve_List('block.list', 'rg1'); 
   Clear_List('list'); -- if you want to clear first list
	 Populate_List('block.list1', 'rg1'); 
end;

[Updated on: Tue, 15 November 2005 20:33] by Moderator

Report message to a moderator

Re: POPULATE LIST ITEMS FROM LIST ITEM VALUE [message #147108 is a reply to message #147021] Tue, 15 November 2005 17:06 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Come on people, how about some 'code' tags. And let's lose some of the blank lines.

David
icon10.gif  Re: POPULATE LIST ITEMS FROM LIST ITEM VALUE [message #147121 is a reply to message #147021] Tue, 15 November 2005 19:05 Go to previous messageGo to next message
aarontan78
Messages: 63
Registered: August 2005
Member
Thanks for the reply,

I put the whole code to my first item_list WHEN-VALIDATE-ITEM but it's not working.
By the way, may I know where should I put my SELECT statement for the record group? I didn't see it in the current codings.

Thanks and regards
Re: POPULATE LIST ITEMS FROM LIST ITEM VALUE [message #147135 is a reply to message #147121] Tue, 15 November 2005 20:35 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Its stored against the record_group in the 'record group query'.

David
icon10.gif  Re: POPULATE LIST ITEMS FROM LIST ITEM VALUE [message #147136 is a reply to message #147135] Tue, 15 November 2005 21:09 Go to previous messageGo to next message
aarontan78
Messages: 63
Registered: August 2005
Member
...which means that I have to create record group rg_id first and enter the query there right?
Thanks!

Regards,
Aaron
Re: POPULATE LIST ITEMS FROM LIST ITEM VALUE [message #147137 is a reply to message #147136] Tue, 15 November 2005 21:28 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
You mean the 'Create_Group_From_Query' ... the When-New-Form-Instance trigger is pretty usual.

David
Re: POPULATE LIST ITEMS FROM LIST ITEM VALUE [message #147142 is a reply to message #147137] Tue, 15 November 2005 22:36 Go to previous messageGo to next message
ashishmate
Messages: 90
Registered: February 2005
Location: Mumbai
Member

Hi

David is right.

you can also use for loop for this at New-Form-instance trigger which is more simpal then creating a query record group any how you will have to create rocordgroup to populate second listitem so better you create it and use same record group for both listitems.



DECLARE 
	A NUMBER := 0 ;
BEGIN
FOR I IN (SELECT * FROM SCOTT.EMP) LOOP
	A := A + 1 ;
	 Add_List_Element('BLOCK.LIST', 1, I.ENAME, I.ENAME);
END LOOP; 

END;
icon14.gif  Re: POPULATE LIST ITEMS FROM LIST ITEM VALUE [message #147148 is a reply to message #147142] Tue, 15 November 2005 23:05 Go to previous message
aarontan78
Messages: 63
Registered: August 2005
Member
Hi, Thanks for the kind solutions.

Regards,
Aaron
Previous Topic: how to handle this error
Next Topic: cursor issue
Goto Forum:
  


Current Time: Fri Sep 20 04:01:43 CDT 2024