Home » Developer & Programmer » Forms » how to show multiple records in a grid according to condition
how to show multiple records in a grid according to condition [message #266473] Tue, 11 September 2007 00:08 Go to next message
sams
Messages: 100
Registered: August 2007
Senior Member
i m making inbox.when a person logins ,he should see only those messages that are sent to him.

i m writing this code.problem is that it show only one message.(for example four messages sent to that person who logins but when he clicks inbox only one is displayed to him)

i have wriiten it on form's "new_form_instance" trigger.it compiles sucessfully and shows only one message at a time.
i have made grid of display boxes to show messages.


declare
	cursor c is
 	select m.msg_no,m.teacher_id,m.msg_subject,m.msg_date 
	from mesage m,teacher t
 where m.receiver_id=  (select t.teacher_id
	                     from teacher t
	                     where t.login_id = :global.log)
 and t.teacher_id = m.teacher_id; 	                    
 begin

	
  open c;
 loop
 	/*fetching value into display boxes of the block 'mesage' 
 	,name of display boxes are'msg_no','teacher_id','msg_subject','msg_date'*/
 	
 fetch c into :mesage.msg_no, :mesage.teacher_id,:mesage.msg_subject,:mesage.msg_date;
 exit when c%notfound;
 end loop;
 close c;

 end;


global.log is global variable that stores login id of each person that logs in.

plz tell me how to show all messages in grid
i m sending the pic of interface.(inbox)
reply
thnks

  • Attachment: pic.bmp
    (Size: 1.37MB, Downloaded 719 times)

[Updated on: Tue, 11 September 2007 00:11]

Report message to a moderator

Re: how to show multiple records in a grid according to condition [message #266563 is a reply to message #266473] Tue, 11 September 2007 02:35 Go to previous messageGo to next message
sams
Messages: 100
Registered: August 2007
Senior Member
plz give suggession if any idea!
thnks
witing 4 reply
Re: how to show multiple records in a grid according to condition [message #266574 is a reply to message #266563] Tue, 11 September 2007 02:53 Go to previous messageGo to next message
induniWD
Messages: 7
Registered: May 2005
Junior Member
Inside the loop, after fetching each row, direct the cursor to the next record of the block (NEXT_RECORD;). At the moment you seem to be fetching the information to the same record replacing the previous one.
Re: how to show multiple records in a grid according to condition [message #266579 is a reply to message #266574] Tue, 11 September 2007 03:05 Go to previous messageGo to next message
sams
Messages: 100
Registered: August 2007
Senior Member
thnks but where to add this:

next_record;

plz add this statment in my given code.
i have added but still only one message is seen.

declare
	cursor c is
 	select m.msg_no,m.teacher_id,m.msg_subject,m.msg_date 
	from mesage m,teacher t
 where m.receiver_id=  (select t.teacher_id
	                     from teacher t
	                     where t.login_id = :global.log)
 and t.teacher_id = m.teacher_id; 	                    
 begin

	
  open c;
 loop
 fetch c into :mesage.msg_no, :mesage.teacher_id,:mesage.msg_subject,:mesage.msg_date;
 next_record;
 exit when c%notfound;
 end loop;
 close c;

 end;


thnks 4 ur reply
Re: how to show multiple records in a grid according to condition [message #266658 is a reply to message #266579] Tue, 11 September 2007 05:51 Go to previous messageGo to next message
Soumen Kamilya
Messages: 128
Registered: August 2007
Location: Kolkata
Senior Member

Use The go_block('mesage'); before fetching record.

declare
	cursor c is
 	select m.msg_no,m.teacher_id,m.msg_subject,m.msg_date 
	from mesage m,teacher t
 where m.receiver_id=  (select t.teacher_id
	                     from teacher t
	                     where t.login_id = :global.log)
 and t.teacher_id = m.teacher_id; 	                    
 begin

	
  open c;
go_block('mesage');
 loop
 fetch c into :mesage.msg_no, :mesage.teacher_id,:mesage.msg_subject,:mesage.msg_date;
 next_record;
 exit when c%notfound;
 end loop;
 close c;

 end;


Cheers
Soumen
Re: how to show multiple records in a grid according to condition [message #266952 is a reply to message #266473] Wed, 12 September 2007 01:40 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Why don't you just base the block 'mesage' on the table 'mesage' and let the 'where clause' do the selection for you?

This manually populating items is VB garbage.
David
Re: how to show multiple records in a grid according to condition [message #266966 is a reply to message #266952] Wed, 12 September 2007 02:23 Go to previous messageGo to next message
sams
Messages: 100
Registered: August 2007
Senior Member
i m not getting your point.what do u mean by "base the block" and "let where clause to do it".
please explain it and can u make change in the code i have given above for clearing me the point(where to make change).

thnks
waiting for reply

[Updated on: Wed, 12 September 2007 02:24]

Report message to a moderator

Re: how to show multiple records in a grid according to condition [message #267308 is a reply to message #266966] Thu, 13 September 2007 00:25 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Start a new form, use the wizard to create a new block and base it on 'mesage', in the 'where' clause add your other logic. You don't need to populate the items manually as Forms will do it for you as part of its default behaviour.

David
Previous Topic: How to Run Developer Form (10g) from Web
Next Topic: Help For Error Code
Goto Forum:
  


Current Time: Tue Dec 03 17:26:30 CST 2024