Home » Developer & Programmer » Forms » Problem in calculation in form 6i (Form 6i)
Problem in calculation in form 6i Wed, 20 January 2010 09:09
 allianz2010 Messages: 101Registered: October 2009 Location: Pakistan Senior Member
i m create form on customer.
in this form customer information and his balance.

i want that when i enter paid amount of any customer in Account Manager Tab.

then it check how much i enter new amount in paid section and it minus above current balance.

and current balance just minus new amount... not calculate previous amount..

i have 2 blocks 1st customer and 2nd customer_paid_amount
i also attached the form screen.

i write this code for this purpose:
```DECLARE

ALRT NUMBER;
PBAL NUMBER;
BEGIN

:PARAMETER.OLDPAID:= NVL(:CS_PAID_AMNT.TOTAL_PAID,0) ;
-- :PARAMETER.MODE_PMTR  when in this parameter value is 2 then its mean now i update the records through form..
IF :PARAMETER.MODE_PMTR = 2 THEN

:CUS_SUPP.CS_BALANCE:= NVL(:CUS_SUPP.CS_BALANCE,0) - PBAL;
END IF;
END IF;

END;
```

[EDITED by LF: applied [code] tags]
[EDITED by DJM: split overly long line]
• Attachment: CUSTOMER.JPG

[Updated on: Thu, 25 February 2010 18:37] by Moderator

Report message to a moderator

Re: Problem in calculation in form 6i [message #440037 is a reply to message #439999] Wed, 20 January 2010 13:54
 Littlefoot Messages: 21127Registered: June 2005 Location: Croatia, Europe Senior MemberAccount Moderator
I didn't quite understand what the question and the problem are.

P.S. I *think* I saw such a screenshot several days ago; is it a school task? Perhaps you could spend some time browsing recent topics and see what's being said. Unless I'm wrong, of course.
Re: Problem in calculation in form 6i [message #440067 is a reply to message #439999] Wed, 20 January 2010 22:32
 allianz2010 Messages: 101Registered: October 2009 Location: Pakistan Senior Member

First of all.. i m not a student.....

i made a project for a shop and in this.. i made a customer form for customer personal information with his balance....

and i create another detail block.... in which i maintain the records that when customer paid his balance amount....

and my problem is this that when i enter any paid amount in detail block then its can not decrease that amount of his Balance amount.. and balance amount is exists in Master block...

and i create block on tables. master block created on master table.
and detail block created on detail table..
and which code i write for this purpose... i write in my previous post.

Re: Problem in calculation in form 6i [message #440085 is a reply to message #440067] Thu, 21 January 2010 00:13
 Littlefoot Messages: 21127Registered: June 2005 Location: Croatia, Europe Senior MemberAccount Moderator
It seems that this is the problem:Quote:
its can not decrease that amount of his Balance amount

Where did you put that code? What trigger executes it?

Does it execute, at all? There are some IFs - did you write them correctly? What do alerts say?
Re: Problem in calculation in form 6i [message #440086 is a reply to message #440085] Thu, 21 January 2010 00:25
 allianz2010 Messages: 101Registered: October 2009 Location: Pakistan Senior Member

Sir I send you form..
in this form Cus_supp is master block and CS_PAID_AMNT and CS_PAYMENT_DETAIL is detail blocks.

I want to auto calculate Balance field...
on the basis of Paid Amount and Amount Adjusted...

and i write code on ""BALANCE_CHK"" form level trigger and i call it on when i update records...

update trigger name is ""EDIT_REC_TRGG""
Re: Problem in calculation in form 6i [message #440107 is a reply to message #440086] Thu, 21 January 2010 02:29
 Littlefoot Messages: 21127Registered: June 2005 Location: Croatia, Europe Senior MemberAccount Moderator
You've written quite a few triggers, but - what calls them?

BALANCE_CHK <is called from> SAVE_REC_TRGG <- nothing calls SAVE_REC_TRGG
EDIT_REC_TRGG <- nothing calls EDIT_REC_TRGG

So, if triggers are not triggered, code can't be executed.
Re: Problem in calculation in form 6i [message #440108 is a reply to message #440107] Thu, 21 January 2010 02:34
 allianz2010 Messages: 101Registered: October 2009 Location: Pakistan Senior Member
Sorry Sir....

i not understand, that what you say, please sir explain some detail.. that what can i do now...

Re: Problem in calculation in form 6i [message #440132 is a reply to message #440108] Thu, 21 January 2010 04:36
 Littlefoot Messages: 21127Registered: June 2005 Location: Croatia, Europe Senior MemberAccount Moderator
If I'm not wrong, this is what is going on:

• You'd like to update an item.
• You've written some code which is supposed to update that item. This code is in a trigger.
• This code never gets executed because nothing runs the trigger.
• Triggers are executed when a certain action happens. For example, WHEN-BUTTON-PRESSED runs when you push the button. POST-QUERY runs after you have executed a query. WHEN-VALIDATE-ITEM runs when you navigate out of the current item.
Your triggers are NEVER executed and, consequentially, item is never updated.
• Think of a trigger (your, named trigger, BALANCE_CHK) as of a procedure. A procedure won't be executed just because it exists - you have to call it. The same goes with your triggers - call them!
Re: Problem in calculation in form 6i [message #440135 is a reply to message #439999] Thu, 21 January 2010 05:07
 cookiemonster Messages: 12793Registered: September 2008 Location: Rainy Manchester Senior Member
I've never seen the point of custom triggers since they're not fired by a specific action like all other triggers. Move the code to actual procedures.
Re: Problem in calculation in form 6i [message #440157 is a reply to message #440135] Thu, 21 January 2010 06:36
 Littlefoot Messages: 21127Registered: June 2005 Location: Croatia, Europe Senior MemberAccount Moderator
I *think* that it might be the result of backward compatibility. I know that Forms 3.0 support procedures, but I'm not sure for earlier versions. Furthermore, Forms version prior to 3.0 used V2 trigger style (where triggers were written in steps), as opposed to V3 style which accepts "normal" PL/SQL code. So, back then, maybe you had to write your own trigger in order to call it as you couldn't write a procedure.

But, then again, I might be wrong.
Re: Problem in calculation in form 6i [message #440159 is a reply to message #440132] Thu, 21 January 2010 07:00
 allianz2010 Messages: 101Registered: October 2009 Location: Pakistan Senior Member
Littlefoot wrote on Thu, 21 January 2010 15:36
If I'm not wrong, this is what is going on:

• You'd like to update an item.
• You've written some code which is supposed to update that item. This code is in a trigger.
• This code never gets executed because nothing runs the trigger.
• Triggers are executed when a certain action happens. For example, WHEN-BUTTON-PRESSED runs when you push the button. POST-QUERY runs after you have executed a query. WHEN-VALIDATE-ITEM runs when you navigate out of the current item.
Your triggers are NEVER executed and, consequentially, item is never updated.
• Think of a trigger (your, named trigger, BALANCE_CHK) as of a procedure. A procedure won't be executed just because it exists - you have to call it. The same goes with your triggers - call them!

i call BALANCE_CHK this trigger when i saved the records... mean i call on it this SAVE_REC_TRGG trigger...

and i call SAVE_REC_TRGG this trigger on menu.

Re: Problem in calculation in form 6i [message #440164 is a reply to message #440159] Thu, 21 January 2010 07:39
 Littlefoot Messages: 21127Registered: June 2005 Location: Croatia, Europe Senior MemberAccount Moderator
allianz2010 wrote on Thu, 21 January 2010 14:00

i call BALANCE_CHK this trigger when i saved the records... mean i call on it this SAVE_REC_TRGG trigger...
True, we agree on that.

Quote:
and i call SAVE_REC_TRGG this trigger on menu.

[Updated on: Thu, 21 January 2010 07:40]

Report message to a moderator

Re: Problem in calculation in form 6i [message #440167 is a reply to message #440164] Thu, 21 January 2010 07:55
 allianz2010 Messages: 101Registered: October 2009 Location: Pakistan Senior Member
[/quote]

and i call it through Menu....
i attached herewith screen...
Re: Problem in calculation in form 6i [message #440188 is a reply to message #440164] Thu, 21 January 2010 09:00
 allianz2010 Messages: 101Registered: October 2009 Location: Pakistan Senior Member
Can i send you my whole project and i have some problems in it....

can i mail you....

may be you give me some ideas about that...

Re: Problem in calculation in form 6i [message #440220 is a reply to message #440188] Thu, 21 January 2010 12:40
 Littlefoot Messages: 21127Registered: June 2005 Location: Croatia, Europe Senior MemberAccount Moderator
A whole project

No, thank you.

OK, if we suppose that menu "Save" calls SAVE_REC_TRGG trigger, what calls EDIT_REC_TRGG which is supposed to do the update (according to your 3rd message in this topic)?

Does it execute, at all? There are some IFs - did you write them correctly? What do alerts say?
Re: Problem in calculation in form 6i [message #440264 is a reply to message #440220] Thu, 21 January 2010 22:27
 allianz2010 Messages: 101Registered: October 2009 Location: Pakistan Senior Member

sir i think you kidding with me....

i m sure you are senior member....

and you ask me this question that...

Quote:
OK, if we suppose that menu "Save" calls SAVE_REC_TRGG trigger, what calls EDIT_REC_TRGG which is supposed to do the update

obviously sir if i call ""SAVE_REC_TRGG"" this trigger on Menu Bar... then i call ""EDIT_REC_TRGG"" this trigger on Menu Bar......

[Updated on: Thu, 21 January 2010 22:28]

Report message to a moderator

Re: Problem in calculation in form 6i [message #440281 is a reply to message #440264] Fri, 22 January 2010 00:06
 Littlefoot Messages: 21127Registered: June 2005 Location: Croatia, Europe Senior MemberAccount Moderator
Huh, right ... I apologize, I should have paid more attention to the screenshot. I didn't mean to make fun of your problem. Sorry again.

 Previous Topic: Where clause in select statement using forms 10g Next Topic: send oracle table to pdf file through forms 6i
Goto Forum:

Current Time: Sun Jul 23 13:56:55 CDT 2017

Total time taken to generate the page: 0.04519 seconds