Home » Developer & Programmer » Forms » populate the list dynamically
populate the list dynamically [message #579811] Fri, 15 March 2013 10:56 Go to next message
irfankundi786@yahoo.com
Messages: 269
Registered: February 2009
Location: pakistan
Senior Member
i want to create the list item dynamically on the when new form instance this is the code....
group_id := create_group_from_query('lst','select (imt.item_id), to_char(imt.item_code, from items_mt imt');
v_num := Populate_group(group_id);
populate_list(v_num,group_id);

but the list is not the populate...please help...
Re: populate the list dynamically [message #579817 is a reply to message #579811] Fri, 15 March 2013 12:35 Go to previous messageGo to next message
joy_division
Messages: 4963
Registered: February 2005
Location: East Coast USA
Senior Member
Without going any further, I see unbalanced parenthesis.
Re: populate the list dynamically [message #579818 is a reply to message #579817] Fri, 15 March 2013 13:23 Go to previous messageGo to next message
irfankundi786@yahoo.com
Messages: 269
Registered: February 2009
Location: pakistan
Senior Member
group_id := create_group_from_query('lst','select imt.item_id, to_char(imt.item_code), from items_mt imt');
now i corrected but the list item is still not populated?????????
Re: populate the list dynamically [message #579820 is a reply to message #579818] Fri, 15 March 2013 13:49 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Well, it is difficult to detect what is true and what is not because you keep posting rubbish. Last statement you posted contains a comma character in front of the FROM keyword, so that wouldn't compile either. Once you decide to post real code you used in a form, someone might decide to try & assist.
Re: populate the list dynamically [message #579867 is a reply to message #579820] Sat, 16 March 2013 02:57 Go to previous messageGo to next message
irfankundi786@yahoo.com
Messages: 269
Registered: February 2009
Location: pakistan
Senior Member

declare
group_id recordgroup;
v_num number;
begin
group_id := create_group_from_query('lst','select (imt.item_id), to_char(imt.item_code) from items_mt imt');
v_num := Populate_group(group_id);
populate_list('lst_product',v_num);
end;


this is actual code...
please help me to populate the list item...
my first field imt.item_id is number and item_code is character field..........
Re: populate the list dynamically [message #579869 is a reply to message #579867] Sat, 16 March 2013 04:53 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Just wondering: why do you insist on dynamic approach? There's nothing "dynamic" in SELECT statement you use.
Re: populate the list dynamically [message #579871 is a reply to message #579869] Sat, 16 March 2013 05:15 Go to previous messageGo to next message
chrisvelarde
Messages: 5
Registered: March 2009
Junior Member
You have populated the data you need. The next step is displaying them correctly.
First define a node collection.
Later you can define the nodes that are contained in the node collection, this can be made dynamically
using a while statement.
Re: populate the list dynamically [message #579884 is a reply to message #579871] Sat, 16 March 2013 08:03 Go to previous messageGo to next message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
@chrisvelarde - list items do not have nodes, you're thinkg of hierarchical trees
@irfankundi786@yahoo.com - are you getting an error?
Re: populate the list dynamically [message #579890 is a reply to message #579884] Sat, 16 March 2013 10:36 Go to previous messageGo to next message
irfankundi786@yahoo.com
Messages: 269
Registered: February 2009
Location: pakistan
Senior Member
i am not using hierarchical tree i am trying to create list item which is populated dynamically having two column one for the
value stored in database and one for the displaying the label.
please anyone which can correct the code i have paste.
error is that that list item is not populating.......
please give me suggestion for the list item not for the tree..
Re: populate the list dynamically [message #579893 is a reply to message #579890] Sat, 16 March 2013 16:42 Go to previous messageGo to next message
chrisvelarde
Messages: 5
Registered: March 2009
Junior Member
I'm sorry, my fault. Didn't personally work on a list.

Nevertheless I assume there has to be an analogy between both OCX objects.

In the TreeView you use for example the command release_obj(hNode); in order to display a previously defined object
in the OCX container. Perhaps there is a similar function/procedure for the list.

It also isn't clear which EVENT triggers the code?

A first approach may be to know exactly which packages are being used by the list and have to be present.
The information you find in the Internet about this topic is very scarce. Had serious trouble figuring out
the architecture for the tree myself. A step by step analysis helped me to put all the missing parts together
until everything became to make sense.

Perhaps you have a data type problem. Your query returns two values and maybe you have to populate
every column in the list separately? Try displaying first only one column and one line to figure out
the logic behind it.




Re: populate the list dynamically [message #579905 is a reply to message #579893] Sun, 17 March 2013 02:34 Go to previous messageGo to next message
ranamirfan
Messages: 535
Registered: January 2006
Location: Pakistan / Saudi Arabia
Senior Member

Dear,
Quote:

Declare
group_id recordgroup;
v_num number;
begin
group_id := create_group_from_query('lst','select (imt.item_id), to_char(imt.item_code) from items_mt imt');
v_num := Populate_group(group_id);
populate_list('lst_product',v_num);
End;



1- Create Procedure in the Forms Program Units.
PROCEDURE populate_Itms_group IS
  rg_name  VARCHAR2(50):= 'ITM';
  rg_id    RecordGroup; 
  errcode  number;
  list_value VARCHAR2(500);
BEGIN 
  rg_id:=Find_Group( rg_name ); 
 
  errcode := POPULATE_Group_WITH_Query( rg_id,'SELECT Item_id,  item_code FROM ITEMS_MT' );  
  clear_list('ITEMS_MT.ITEM_ID'); 
  -- Field Name where you put your List
  populate_list('ITEMS_MT.ITEM_ID',rg_id); 

EXCEPTION
WHEN OTHERS THEN 
MESSAGE('No Value ');
END; 


2- Call this WHEN-NEW-FORM-INSTANCE
populate_Itms_group ;

3- Go to Item Field where you want to put your Item List
Change his Item Type - List Item

4- Go to Elements in List click it and put there
List Elements - Dummy & List Item value - 0

Try this Hopefully it'll work.


Regards,
Irfan
Re: populate the list dynamically [message #579910 is a reply to message #579905] Sun, 17 March 2013 07:28 Go to previous messageGo to next message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member
Have u solved your problem






Re: populate the list dynamically [message #579913 is a reply to message #579893] Sun, 17 March 2013 08:49 Go to previous messageGo to next message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
chrisvelarde wrote on Sat, 16 March 2013 21:42

In the TreeView you use for example the command release_obj(hNode); in order to display a previously defined object
in the OCX container. Perhaps there is a similar function/procedure for the list.

No there isn't.

chrisvelarde wrote on Sat, 16 March 2013 21:42

It also isn't clear which EVENT triggers the code?

That is a good question

chrisvelarde wrote on Sat, 16 March 2013 21:42

A first approach may be to know exactly which packages are being used by the list and have to be present.

None.

chrisvelarde wrote on Sat, 16 March 2013 21:42

The information you find in the Internet about this topic is very scarce.

Probably because the form builder help topics on the subject are comprehensive.

chrisvelarde wrote on Sat, 16 March 2013 21:42

Your query returns two values and maybe you have to populate every column in the list separately?

No.


Re: populate the list dynamically [message #579966 is a reply to message #579913] Mon, 18 March 2013 07:15 Go to previous messageGo to next message
mughals_king
Messages: 392
Registered: January 2012
Location: pakistan
Senior Member
Dear @Ranamirfan hope this time u would get something here is some example or otherwise
tell me i shall send u .FMB file

DECLARE 
	rg_name  VARCHAR2(40) := 'Salary_Range'; 
	rg_id    RecordGroup; 
	errcode  NUMBER; 
BEGIN
	rg_id := Find_Group( rg_name ); 
	
  IF NOT Id_Null(rg_id) THEN 
  	 Delete_Group( rg_id ); 
  END IF; 
  
  IF :RDG_VAL = 'E' 
  THEN
      rg_id := Create_Group_From_Query( rg_name, 'SELECT ename ename1,' 
                                               ||'ename ename2 ' 
                                               ||'FROM EMP '
                                               ||'ORDER BY 1');
  ELSE
  	  rg_id := Create_Group_From_Query( rg_name, 'SELECT dname dname1,' 
                                               ||'dname dname2 ' 
                                               ||'FROM dept '
                                               ||'ORDER BY 1');
  END IF;                                              
  errcode := Populate_Group( rg_id ); 
  populate_List('TEST_LIST',rg_id);
END;



mughal Smile

[Updated on: Mon, 18 March 2013 07:16]

Report message to a moderator

Re: populate the list dynamically [message #579968 is a reply to message #579966] Mon, 18 March 2013 07:51 Go to previous message
ranamirfan
Messages: 535
Registered: January 2006
Location: Pakistan / Saudi Arabia
Senior Member

Mr.Mughals.
My above reply working fine for me.

Regards,
Irfan
Previous Topic: When-button-pressed button problem
Next Topic: FRM-40202: Field must be entered.
Goto Forum:
  


Current Time: Mon Jul 01 10:40:13 CDT 2024