| 
		
			| Storing data into the combo box [message #260833] | Tue, 21 August 2007 01:39  |  
			| 
				
				
					| james_aron Messages: 32
 Registered: July 2007
 Location: chennai
 | Member |  |  |  
	| hi all, I am working in oracle forms 6i. My problem is, I want to store data into the combo box from the back-end(sql database server). My combo box is none database item please help me of how to store data into combo box from database.
 
 I created trigger like below but its not working.
 
 WHEN-NEW-ITEM-INSTANCE
 ------------------------
 declare
 begin
 loop
 select prod_name into :control_main.combo from stock;
 end loop;
 end;
 
 hope u guys will help me!
 
 
 regards,
 jame
 
 [Updated on: Tue, 21 August 2007 01:42] Report message to a moderator |  
	|  |  | 
	|  | 
	| 
		
			| Re: Storing data into the combo box [message #260841 is a reply to message #260833] | Tue, 21 August 2007 01:53   |  
			| 
				
				
					| DRASTANT Messages: 21
 Registered: July 2007
 Location: KENYA
 | Junior Member |  |  |  
	| Helllooo james how r u???? 
 Here is solution for your problem
 
 first u decide how u want to store data is it static or query based,
 
 1. if it is static just go to property palate and add elements in list
 
 2. if it is based on a query u need to create a record group based on query u need to fill the combobox and then u need to populate this combo box using this record group u can use
 POPULATE_LIST built in for doing this on any trigger level
 
 
 hope this should solve your problem
 
 Drastant Mehta
 Nairobi
 |  
	|  |  | 
	|  | 
	| 
		
			| Re: Storing data into the combo box [message #260885 is a reply to message #260849] | Tue, 21 August 2007 03:25   |  
			| 
				
				
					| musman Messages: 147
 Registered: July 2007
 Location: Lahore
 | Senior Member |  
 |  |  
	| you have to create arg list and columns ..do try it ur self. --------------------------------------------------------
 hay i use this code on non database item to populate  list.
 Use this on Form level WHEN_NEW_FORM_INSTANCE..
 it will work..
 -------------------------------------------------------
 
 declare
	rg_name VARCHAR2(40) :='TYPEID';
	rg_id RecordGroup;
	gc_id GroupColumn;
	errcode NUMBER;
	
begin
	CLEAR_LIST('MAIN.SYS_ID');
	rg_id := Find_Group(rg_name);
	IF Id_Null(rg_id) then
		rg_id := Create_Group(rg_name);
	  gc_id := Add_Group_Column(rg_id,'DESCRIPTION',CHAR_COLUMN,60);
          gc_id := Add_Group_Column(rg_id,'TYPE_ID',CHAR_COLUMN,3);
	
	end if;
	errcode := Populate_Group_With_Query(rg_id,
                   'select sym_code,company_code from companies order by sym_code');
	message('error code is'||errcode);
	POPULATE_LIST('MAIN.SYS_ID',RG_ID);
end;
 Use combo-box list ...
 
 Upd-mod: Code line too long.
 [Updated on: Thu, 23 August 2007 20:28] by Moderator Report message to a moderator |  
	|  |  | 
	| 
		
			| Re: Storing data into the combo box [message #260955 is a reply to message #260833] | Tue, 21 August 2007 05:59   |  
			| 
				
				
					| hemavb Messages: 103
 Registered: May 2007
 Location: Dubai , UAE
 | Senior Member |  |  |  
	| Same code modified it a little... 
 Musman, no hard feelings.
 
 
 
declare
	rg_name VARCHAR2(40) :='TYPEID';
	rg_id RecordGroup;
	errcode NUMBER;
	
begin
	CLEAR_LIST('MAIN.SYS_ID');  -- MAIN.SYS_ID is the List Item
	rg_id := Find_Group(rg_name);
	IF Id_Null(rg_id) then
	   rg_id := Create_Group_from_QUERY(rg_name,
                    'select sym_code,company_code from companies order by sym_code');
	end if;
	errcode := Populate_Group(rg_id);
	message('error code is'||errcode);
	POPULATE_LIST('MAIN.SYS_ID',RG_ID);
end;
[Updated on: Thu, 23 August 2007 20:29] by Moderator Report message to a moderator |  
	|  |  | 
	| 
		
			| Re: Storing data into the combo box [message #260961 is a reply to message #260849] | Tue, 21 August 2007 06:34   |  
			| 
				
				
					| DRASTANT Messages: 21
 Registered: July 2007
 Location: KENYA
 | Junior Member |  |  |  
	| James just read this 
 Create a Record Group not lov and then populate it on using this code
 create a rg_dept as record group
 department as combo box item
 i m using it with forms 10g
 try it out
 
 
 DECLARE
 STATUS NUMBER;
 Problem EXCEPTION;
 BEGIN
 STATUS:=POPULATE_GROUP('rg_dept');
 IF STATUS <> 0 THEN
 RAISE problem;
 ELSE
 POPULATE_LIST('DEPARTMENT', 'rg_dept');
 END IF;
 EXCEPTION
 WHEN problem THEN
 message('We have a problem to query the PRODUCT table.');
 
 END;
 
 |  
	|  |  | 
	|  | 
	|  | 
	| 
		
			| Re: Storing data into the combo box [message #261188 is a reply to message #260833] | Wed, 22 August 2007 02:07   |  
			| 
				
				
					| hemavb Messages: 103
 Registered: May 2007
 Location: Dubai , UAE
 | Senior Member |  |  |  
	| I agree David, but there are cases when a client is adamant on using a drop down list where an LOV would do wonders. It takes time for them to the "popped - up" list as a client of mine calls it. But soon they are more happy with "pressing F9" rather than the drop-down list. Till then we have to work extra.
 
 -Hemavb
 |  
	|  |  | 
	|  | 
	| 
		
			| Re: Storing data into the combo box [message #261219 is a reply to message #260833] | Wed, 22 August 2007 03:10   |  
			| 
				
				
					| hemavb Messages: 103
 Registered: May 2007
 Location: Dubai , UAE
 | Senior Member |  |  |  
	| LOV is a much better form of selection tool than drop down lists. The Users can resize an LOV, they can get more info in the form of additional columns, search scope is widened.
 
 As far as i go i will at any time prefer to give my clients LOVs be it 6, 6i, 9i or 10g. Even when i give them a drop down field i still provide an LOV for the same selection. I know that clients will use it more than the drop down, once they come to know that the filtering options available in LOV are much much better than a drop List.
 
 -Hemavb
 |  
	|  |  | 
	| 
		
			| Re: Storing data into the combo box [message #261343 is a reply to message #261219] | Wed, 22 August 2007 06:22   |  
			| 
				
				
					| james_aron Messages: 32
 Registered: July 2007
 Location: chennai
 | Member |  |  |  
	| hi all, Thank you very much for ur replies.....but still i had problem.
 
 My record group name(not lov) is RG_DEPT and combo_box name is combo...........
 
 DECLARE
  STATUS    NUMBER;
  Problem   EXCEPTION;
BEGIN
  STATUS  := POPULATE_GROUP ('RG_DEPT');
  IF STATUS <> 0 THEN
    RAISE problem;
  ELSE
    POPULATE_LIST ('combo', 'RG_DEPT');
  END IF;
EXCEPTION
  WHEN problem THEN
    message ('We have a problem to query the PRODUCT table.');
END;Showing error like....... "Invalid record group for list population";
 wat would be the error please let me know.......
 
 Please do ur best
 
 thanks
 
 regards,
 jame
 [Updated on: Thu, 23 August 2007 20:30] by Moderator Report message to a moderator |  
	|  |  | 
	|  | 
	|  | 
	| 
		
			| Re: Storing data into the combo box [message #262304 is a reply to message #260833] | Sun, 26 August 2007 01:52  |  
			| 
				
				
					| hemavb Messages: 103
 Registered: May 2007
 Location: Dubai , UAE
 | Senior Member |  |  |  
	| check for two things... 
 If your parameters are in the right order
 OR
 what is the data size of your combo box and that of the data that you are passing to it.
 
 The length of the column, that is to take the VALUE of the combo list element, should be lesser than or equal to the combo box data length.
 |  
	|  |  |