Home » Developer & Programmer » Forms » Fetching Records in Detail
Fetching Records in Detail [message #298986] Fri, 08 February 2008 07:24 Go to next message
asadkhan_2
Messages: 35
Registered: January 2008
Member
Oracle Forms 10G database 10G Windows XP
I have Two Data Blocks Master and Detail
in Detail data is fetched through a cursor not from master table but from another table eg
if user selects the product code in master then the tests which are defined against that product fetched in detail.
But the problem is when user selects the product code and press button the form message displayed do u want to save the changes and then it fetch records one by one on the same row
Firstly i want to display that data on multiple lines depends on records and secondly to disable that message but not hiding message
by setting message level
the Cursor code is as below please check
declare
v_flag boolean :=False;
cursor cr_product is
select t.test_code, t.method_code, t.min_range, t.max_range
from qcl13_test_method t
where t.prod_code = :detail.prod_code
and t.active = 'Yes';
rec_pr cr_product%rowtype;
begin
--clear_block;
open cr_product;
loop
fetch cr_product into rec_pr;
exit when cr_product%notfound;

:detail.test_code:=rec_pr.test_code;
:detail.method_code:=rec_pr.method_code;
:detail.min:=rec_pr.min_range;
:detail.max:=rec_pr.max_range;

next_record;
v_flag:=True;
end loop;
-- v_flag:=True;


close cr_product;
if v_flag=False
then
message('No data Found');
message('No data Found');
--else
-- null;


end if;


end;
Re: Fetching Records in Detail [message #299008 is a reply to message #298986] Fri, 08 February 2008 09:16 Go to previous messageGo to next message
rajy_salim
Messages: 204
Registered: January 2008
Location: Beirut - Lebanon
Senior Member
1- if this message appears, that means that you are using a database data block and the changes need to bee comitted.
2- the product code must not be in the detail if you are using it as parameter ( = :detail.product_code)
3- you need to create the record by using the crate_record builtin
4- the v_flag must not be inside the loop, you put it to true if the cursor returns at least one row (after the first fetch):
if cursor%found then v_flag := true;
Re: Fetching Records in Detail [message #299080 is a reply to message #299008] Fri, 08 February 2008 23:23 Go to previous messageGo to next message
asadkhan_2
Messages: 35
Registered: January 2008
Member
First of all sorry the product code is in master block and then on the basis of product code the tests are fetched into detail but when i select product and click on button in master to fetch data the message appears and then it populate the detail block one by one on the same row
thanks
Re: Fetching Records in Detail [message #299240 is a reply to message #298986] Mon, 11 February 2008 00:21 Go to previous message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Don't use cursor:
Populate block using cursor
http://www.orafaq.com/forum/m/605/67467/?srch=populate+block+cursor+create_record#msg_605
and my feelings about it.
http://www.orafaq.com/forum/m/134237/67467/?srch=populate+block+cursor+create_record#msg_134237
Another one of my rants.
http://www.orafaq.com/forum/mv/msg/74947/213213/67467/#msg_213213

Use Master-Detail:
Master-Detail entries
Simple
http://www.orafaq.com/forum/m/218834/67467/#msg_218834
Query
http://www.orafaq.com/forum/m/201562/67467/?srch=master+detail+david+query#msg_201562

David
Previous Topic: Using Java Importer- java.lang.NoClassDefFoundError
Next Topic: how can i identify any changes in text item?
Goto Forum:
  


Current Time: Sat Dec 10 16:18:39 CST 2016

Total time taken to generate the page: 0.09278 seconds