Home » Developer & Programmer » Forms » detailed records problem.. help plz.. & dont want the when-validate-record fires after the post-
detailed records problem.. help plz.. & dont want the when-validate-record fires after the post- [message #167128] Tue, 11 April 2006 08:10 Go to next message
haitham
Messages: 60
Registered: February 2006
Member
in amaster detail data block form i used the execute_query; in the when-new-block-instance at the detail data black level to display the corresponding detailed records when the user enters a primary key value in the master data block..

i want to display a description (in anon database item)of a displayed item of the detailed record so after execute_query; ,i wrote the following :

go_block('detailbock');
first_record;
loop
--display the description of the item for the current record
exit when :system.last_record='true';
next_record;
end loop;

it works (the descriptions are displayed) but it raised unhandled exception ora-01403 (no data found) ,in the debug console i found that the :system.last_record is always false such that the loop didnt exit when the next_record reaches the last record and so it raised unhandled exception (coz data retreived from an empty record).

so wot can i do to solve this problem and display the description of the item for the detailed record....

i realy need help..


Re: detailed records problem.. help plz.. [message #167209 is a reply to message #167128] Tue, 11 April 2006 19:59 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Use the Post-Query trigger on the detail block to populate the non-database description.

David
Re: detailed records problem.. help plz.. [message #167733 is a reply to message #167209] Sun, 16 April 2006 05:00 Go to previous messageGo to next message
haitham
Messages: 60
Registered: February 2006
Member
the when-validate-record trigger fires each time the post-query trigger fires becoz the detailed record status becomes changed (i read that in the online help).....
anyway after the select statement in the post-query trigger i wrote the following :
s:=get_record_property(current_record+1,'detailblock',status);
message(s);
set_record_property(current_record+1,'detailblock',status,query_status);
-- s is varchar2(20)
i found that :
after displaying description for the first detailed record the message was not displayed ( strange )and the when-validate-record trigger didnt fire ( thats wot i want )
after displaying description for the second detailed record the message was displayed and the when-validate-record trigger fires ( i dont know y ).

the strange thing also is that when i used the debug console i found that the record status of each detailed record is query not changed ( before setting the record property status)..

plz give me an idea or solution for this problem..
dont want the when-validate-record fires after the post-query fires [message #167734 is a reply to message #167128] Sun, 16 April 2006 05:03 Go to previous messageGo to next message
haitham
Messages: 60
Registered: February 2006
Member
i have a master detail data block ,i used execute_query; in the when-new-block-instance trigger to display the corresponding detailed records of the primary key value entered in the master data block and
i used post-query trigger to dispaly description in a non database display item for a database item of each detailed record but the when-validate-record trigger fires each time the post-query trigger fires becoz the detailed record status becomes changed (i read that in the online help).....
anyway after the select statement in the post-query trigger i wrote the following :

s:=get_record_property(current_record+1,'detailblock',status);
message(s);
set_record_property(current_record+1,'detailblock',status,query_status);
-- s is varchar2(20)

i found that :
after displaying description for the first detailed record the message was not displayed ( strange )and the when-validate-record trigger didnt fire ( thats wot i want )
after displaying description for the second detailed record the message was displayed and the when-validate-record trigger fires ( i dont know y ).

the strange thing also is that when i used the debug console i found that the record status of each detailed record is query not changed ( before setting the record property status)..

plz give me an idea or solution for this problem..

[Updated on: Sun, 16 April 2006 05:09]

Report message to a moderator

Re: dont want the when-validate-record fires after the post-query fires [message #167736 is a reply to message #167734] Sun, 16 April 2006 05:26 Go to previous messageGo to next message
RJ.Zijlstra
Messages: 104
Registered: December 2005
Location: Netherlands - IJmuiden
Senior Member
Hi Haitham,

I think the problem lies in the fact, that you are trying to mimmick Forms:

If you make a from, based on master-detail, do NOT use triggers to populate the child block. NEVER.
Instead use the 'normal' Forms relationship, which you can see at the 'end' of the block in the navigator. When you use that one, it will not be necessary to use any trigger.

If you have a master block which displays, let's say, 5 rows and all rows have children then you will see, that the child block refreshes automatically when you navigate through the rows in the master block. (For all clarity: without writing a single trigger)

Any time a When validate Trigger fires, there MUST be some item that according to forms needs validating. If you see -as you stated- that there are no items changed then there must be something you did not notice.

Try to rebuild the forms correctly with the above mentioned relation and then look if the trigger fires. Your post query trigger will not let the when validate trigger fire, as long as all the items afflicted are non database items. Otherwise, the when validate trigger will fire!


HTH,

Regards
Rob Zijlstra
icon14.gif  Re: dont want the when-validate-record fires after the post-query fires [message #167737 is a reply to message #167734] Sun, 16 April 2006 05:29 Go to previous messageGo to next message
sanka_yanka
Messages: 184
Registered: October 2005
Location: Kolkata
Senior Member

Check the :system.mode option in the trigger when-validate-record. If the :system.mode return NORMAL then fires ur query from ur when-validate-recordtrigger.
I think it will solve ur problem.

[Smile]Cheers,
Sanka
Re: dont want the when-validate-record fires after the post-query fires [message #167758 is a reply to message #167736] Sun, 16 April 2006 20:43 Go to previous messageGo to next message
haitham
Messages: 60
Registered: February 2006
Member
in the online help of post query trigger in usage notes they say :
when u use a post query trigger to select non base table values into control items forms developer markers each record as changed and so fires the when validate item trigger by default . u can avoid the execution of the when validate item trigger by explicity setting the status property of each record to query in the post query trigger . to set record status programmatically , use set record property.

in the detail data block i used the when new block instance coz to display all the items values of the detailed record u have to wirte the execute_query in the when new block instance ...
but if u didnt use any trigger then only the foriegn key value of the detailed record will be displayed..
could u help me with anoter solution ..

[Updated on: Sun, 16 April 2006 20:44]

Report message to a moderator

Re: dont want the when-validate-record fires after the post-query fires [message #167759 is a reply to message #167737] Sun, 16 April 2006 20:46 Go to previous messageGo to next message
haitham
Messages: 60
Registered: February 2006
Member
what do u mean of <fires ur query from ur when-validate-record trigger> ?
anyway the system.mode returns query...

do u have any solution
Re: detailed records problem.. help plz.. [message #167912 is a reply to message #167733] Mon, 17 April 2006 21:51 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Why are you getting the 'status' of the 'next' record? Just work with the current record. Do your work one record at a time. The reason the WVR trigger is firing is probably because you are changing the value in a database field in the Post-Query trigger. Verify that you are only changing non-database fields in the Post-Query.

David
Re: dont want the when-validate-record fires after the post-query fires [message #167950 is a reply to message #167734] Tue, 18 April 2006 01:52 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
DO NOT REPOST THE SAME INFORMATION INTO A NEW THREAD. If a question is not answered within a few days then put a short clarifying message on the old thread so that the outstanding problem is brought to people's attention.

David
Previous Topic: plsase send me functional key sample form
Next Topic: 2 Tab Canvas Fetch data in 2nd Tab Canvas
Goto Forum:
  


Current Time: Fri Sep 20 09:29:32 CDT 2024