Post Query Trigger [message #497694] |
Sun, 06 March 2011 20:59 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
mkhalil
Messages: 108 Registered: July 2006 Location: NWFP Peshawar Pakistan
|
Senior Member |
|
|
Dear Collegues,
I am very thankfull to all of you that your guidance has always solved my problems and i gaind knowledge from your expertise.
Now i have another problem for which i have searched the board but is unable to solve it so far.
Here is the code
declare
currec varchar2(100) := :system.cursor_record;
-- runbal number;
begin
if currec = '1' then
:gsubldgr.balance := nvl(nvl(:gsubldgr.credits,0) - nvl(:gsubldgr.charges,0),0);
:global.runbal := nvl(:gsubldgr.balance,0);
else
:gsubldgr.balance := :global.runbal + (nvl(:gsubldgr.credits,0) - nvl(:gsubldgr.charges,0));
:global.runbal := nvl(:gsubldgr.balance,0);
end if;
end;
I have placed this code on key-next-item of a text item placed before the above three items i.e. charges,credits and balance.
At the time of data entry this code is working well but at the time of query it does not work but only execute the first expression of if statement whereas i have copy and past the same trigger in Post-Query trigger of the block.
Where is the problem? Would any one can help me.
Muhammad Khalil
|
|
|
|
Re: Post Query Trigger [message #497838 is a reply to message #497727] |
Mon, 07 March 2011 08:21 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
mkhalil
Messages: 108 Registered: July 2006 Location: NWFP Peshawar Pakistan
|
Senior Member |
|
|
Well done littlefoot. It working fine with :system.trigger_record in post-query trigger. Thanks a lot.
I used when-validate-item instead of key-next-item but when i delete a record the cursor not exit from the item if all records have been deleted. Is any solution for such problem.
|
|
|
Re: Post Query Trigger [message #497963 is a reply to message #497838] |
Mon, 07 March 2011 23:21 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
mkhalil
Messages: 108 Registered: July 2006 Location: NWFP Peshawar Pakistan
|
Senior Member |
|
|
Perhaps i can't explain my view point clearly.
First i used when-validate-item trigger instead of key-next-item. It was working fine but when i delete one by one all records in the block. After deletion of last record the cursor did not exit from the text item to which when-validate_item trigger was attached, therefore, i copy the code to key-next-item trigger. Is there any solution so that i may again use the when-validate-item trigger instead of key-next-item.
|
|
|
Re: Post Query Trigger [message #497977 is a reply to message #497963] |
Tue, 08 March 2011 00:13 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
![](/forum/images/custom_avatars/72104.gif) |
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
It seems that code you wrote (and posted in your first message) should be moved into a procedure.
Then you'd call that procedure whenever appropriate (in WHEN-VALIDATE-ITEM, KEY-DELREC, etc. triggers).
|
|
|