Home » Developer & Programmer » Forms » poplist problem??help?
poplist problem??help? [message #148507] Thu, 24 November 2005 13:39 Go to next message
ramisy2k
Messages: 150
Registered: April 2005
Senior Member
Hello gentleman,

I am facing big problem hope any body would help

I have single record db block on a base table 'T' on my Form
on the form there is base table poplist..
the datatype of poplist item is number
at new form instance triigger i use the following code to populate my poplist with the elements..and then execue_query



 declare
  rg_name  VARCHAR2(40) := 'country_name';
  rg_id    RecordGroup;
	gc_id    GroupColumn;
	errcode number;

 q1 varchar2(200) := 'SELECT  country_name, country_id from countries';
 begin
  :system.message_level := 5;
	rg_id := Find_Group(rg_name);
	if not Id_Null(rg_id) then
	   Delete_Group(rg_id);
	ELSE IF
		Id_Null(rg_id) then
	rg_id := Create_Group(rg_name);
	gc_id := Add_Group_Column(rg_id, 'country_name',CHAR_COLUMN,100);
	gc_id := Add_Group_Column(rg_id, 'country_ID', CHAR_COLUMN,5);

	errcode := Populate_Group_With_Query( rg_id,q1);
  --abort_query;
	populate_list('poplist_item_name',rg_id);
	end if;
	end if;
	
 end;

EXECUTE_QUERY;




it is working fine and the names of countries are shown in the poplist and i can save, change the names at run time and then after chanigng the country names the country_Id's are stored in the poplist_item_field in the back end table

the problem is that I want to use this query on my code above

q1 varchar2(200) := 'SELECT  country_name, country_id from countries 
                      where 
                      countries.country_id = block_name.country_id';


but when i use this code imy poplist does not populate at run time, it is perhaps due to the WHERE clause in the query..actaully i want to populate the poplist based on the country_id of the block that is retrived after the query is executed and is different for each record..

how can i fix this problem??
thanks in advance

regards
Re: poplist problem??help? [message #148548 is a reply to message #148507] Thu, 24 November 2005 22:16 Go to previous messageGo to next message
ashok_it
Messages: 40
Registered: November 2005
Location: Singapore
Member
hi,
hope this will work.

'SELECT country_name, country_id from countries
where
countries.country_id = '|| :block_name.country_id ;

tks
ashok
Re: poplist problem??help? [message #148560 is a reply to message #148548] Fri, 25 November 2005 00:30 Go to previous messageGo to next message
ramisy2k
Messages: 150
Registered: April 2005
Senior Member
ashok,
the problem is not solved..the poplist id still not populated

declare
  rg_name  VARCHAR2(40) := 'country_name';
  rg_id    RecordGroup;
	gc_id    GroupColumn;
	errcode number;

q1 varchar2(200) := 'SELECT  country_name, country_id from countries where countries.country_id = '|| :block_name.country_id ;
 begin
  :system.message_level := 5;
	rg_id := Find_Group(rg_name);
	if not Id_Null(rg_id) then
	   Delete_Group(rg_id);
	ELSE IF
		Id_Null(rg_id) then
	rg_id := Create_Group(rg_name);
	gc_id := Add_Group_Column(rg_id, 'country_name',CHAR_COLUMN,100);
	gc_id := Add_Group_Column(rg_id, 'country_ID', CHAR_COLUMN,5);

	errcode := Populate_Group_With_Query( rg_id,q1);
  --abort_query;
	populate_list('poplist_item_name',rg_id);
	end if;
	end if;
	
 end;

EXECUTE_QUERY;




what is the problem what it is not populating, is taht due to the fact the befopre the execution of query there is no value in
:block_name.country_id ;

what shoudl i do now??
Re: poplist problem??help? [message #150021 is a reply to message #148560] Tue, 06 December 2005 00:51 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Have you solved your problem?

Try 'SELECT country_name, country_id from countries
where
countries.country_id = nvl('|| :block_name.country_id ||',countries.country_id)' ;

David
Re: poplist problem??help? [message #150238 is a reply to message #150021] Tue, 06 December 2005 21:13 Go to previous message
ashok_it
Messages: 40
Registered: November 2005
Location: Singapore
Member
hi
hope this will work for you. but make sure your poplist item datatype.


declare
rg_name VARCHAR2(40) := 'country_name';
rg_id RecordGroup;
gc_id GroupColumn;
errcode number;

q1 varchar2(200) := 'SELECT country_name, country_name from from countries where countries.country_id = '|| nvl(:block_name.country_id,country_id) ;

begin
rg_id := Find_Group(rg_name);
if not Id_Null(rg_id) then
Delete_Group(rg_id);
end if;
if Id_Null(rg_id) then
rg_id := Create_Group_from_query(rg_name, q1);

errcode := Populate_Group( rg_id);

populate_list(''poplist_item_name'','rg1');
end if;

end;
Previous Topic: Forms 6i on Oracle 10g UTF8
Next Topic: Vertical Scroll doesn't scroll
Goto Forum:
  


Current Time: Fri Sep 20 02:16:48 CDT 2024