Home » Developer & Programmer » Forms » Problem in displaying multiple records (Forms 6i)
Problem in displaying multiple records [message #313498] Sun, 13 April 2008 03:51 Go to next message
dillango
Messages: 145
Registered: January 2008
Senior Member
Dear All,

I have the base table having just three following columns

Employee number
date of vacation
Description


In the form while entering the new record, I want to display all his previous transaction history
available in the same table.

I have created one non basetable block with tabular column (10 records) and displayed in the same canvass (with
base table block).

In Employeenumber column I have written the following code in "key_next_item" trigger.

If :empno is not null then
declare
cursor c1 is select empno,vacationdate,descrption from vacationtable where empno = :empno;
begin
go_block('CONBLOCK') -- Non base table block
first_record;
for s1 in c1 loop
:conblock.empno = s1.empno;
:conblock.vacationdate = s1.vacationdate;
:conblock.descrption = s1.descrption;
next_record;
end loop;
end;
end if;


Now the problem is, I have 5 records in the table but it displaying only the last record.
Actually, cursor fetching all the five records but it displaying in the first row only (just overwriting the same row).

Can you please suggest where exactly the problem I made.

Ilango
Re: Problem in displaying multiple records [message #313527 is a reply to message #313498] Sun, 13 April 2008 08:28 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I'd rather use only one one (database) block, based on the table you mentioned. Prior to entering a new record, execute query on employee number (choose your preferred ORDER BY; it will probably be "date of vacation ASC"), go to the last record and enter new data.

Doing so, you'd avoid another block, populating it using PL/SQL code (which, as you've said, doesn't work) and keep the whole thing simple.
Re: Problem in displaying multiple records [message #313543 is a reply to message #313527] Sun, 13 April 2008 09:42 Go to previous messageGo to next message
dillango
Messages: 145
Registered: January 2008
Senior Member
Thank you Mr.Littlefoot,

However, In order to avoid the confusion to the reader, I mentioned just three columns. Actualy I have plenty of columns in the table and using form type to capture all those informations. Meanwhile, I would like to display few key columns (from the same table) in tabular form and if the user wishes to check the detailed information, he can double click the mouse from a required row.

All my forms have my own pushbuttons for Add, edit, view, first,next,prior etc.. I never used the default type.

One thing I really did not understand is, When I go to a particular block and if I mentioned anything as "Next_record" it should applicable only that block right? actually it is effecting the other block also (base table block).

Even having developed so many forms, I really did not understand this.

Ilango







Re: Problem in displaying multiple records [message #313992 is a reply to message #313543] Tue, 15 April 2008 07:43 Go to previous messageGo to next message
athar.fitfd@hotmail.com
Messages: 193
Registered: October 2007
Location: pakistan
Senior Member
Dear, You are using first_record before you assign values to the fields from the cursor that keeps the cursor exactly on the first record of the block even you have used next_record at last.

I think you need to remove the first_record.

Ok Bye

Athar
Re: Problem in displaying multiple records [message #313995 is a reply to message #313992] Tue, 15 April 2008 07:48 Go to previous messageGo to next message
athar.fitfd@hotmail.com
Messages: 193
Registered: October 2007
Location: pakistan
Senior Member
sorry for my previous post.
your first_record is out of the loop.
i think is not the problem.
Rather you need to use a button to execute the code that is in the same block you want to populate.

Re: Problem in displaying multiple records [message #314188 is a reply to message #313498] Wed, 16 April 2008 00:34 Go to previous messageGo to next message
thomasscaria
Messages: 21
Registered: July 2007
Location: Kuwait
Junior Member
add the line
" CREATE_RECORD "
after the loop is opened.
Re: Problem in displaying multiple records [message #314208 is a reply to message #313498] Wed, 16 April 2008 01:32 Go to previous messageGo to next message
spmano1983
Messages: 269
Registered: September 2007
Senior Member
Friend,

What is exact problem yours? I have made few changes in your code. When i going to enter employee number in database block, then it will display the all prevous records for that particular empno in same canvas. Sorry, if i mis understood your requirement. Find the attached snapshot also.

declare
cursor c1 is select empno,date_of_vacation,descr from empsam where empno = :empsam.empno; 
begin
If :empsam.empno is not null then
go_block('empsam1'); -- Non base table block
first_record;
for s1 in c1 loop
:empsam1.empno := s1.empno;
:empsam1.date_of_vacation := s1.date_of_vacation;
:empsam1.descr := s1.descr;
next_record;
end loop;
end if;
end;



Thanks
Mano
  • Attachment: snap.pdf
    (Size: 58.50KB, Downloaded 1398 times)
Re: Problem in displaying multiple records [message #314334 is a reply to message #313498] Wed, 16 April 2008 06:43 Go to previous message
sinida1984
Messages: 83
Registered: September 2007
Location: India
Member
May be in your non database block, all the fields of type display item... Make any one of the field as text item and try if none of the field are of text item. If all are text item, I don't know ..... Sad

Sinida
Previous Topic: how to send bytes to the serial port
Next Topic: How to execute the values automatically in a form at run time?
Goto Forum:
  


Current Time: Fri Feb 14 14:14:43 CST 2025