Home » Developer & Programmer » Forms » Problem in calculation in form 6i (Form 6i)
Problem in calculation in form 6i [message #439999] Wed, 20 January 2010 09:09 Go to next message
allianz2010
Messages: 101
Registered: 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.OLDADJ := NVL(:CS_PAID_AMNT.TOTAL_ADJUSTED,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 

	SET_ALERT_PROPERTY('COMMON_ALRT', ALERT_MESSAGE_TEXT, 
                           'OLD PAID AMOUNT='||:PARAMETER.OLDPAID ||'OLD TOTAL ADJUSTED='||:PARAMETER.OLDADJ );
	ALRT := SHOW_ALERT('COMMON_ALRT');
		IF :CS_PAID_AMNT.TOTAL_PAID <> :PARAMETER.OLDPAID OR :CS_PAID_AMNT.TOTAL_ADJUSTED <> :PARAMETER.OLDADJ THEN 
			PBAL := (NVL(:CS_PAID_AMNT.TOTAL_PAID,0) + NVL(:CS_PAID_AMNT.TOTAL_ADJUSTED,0))
                                - (:PARAMETER.OLDPAID + :PARAMETER.OLDADJ );
			SET_ALERT_PROPERTY('COMMON_ALRT', ALERT_MESSAGE_TEXT, 'NEW PAID BALANCE='||PBAL );
			ALRT := SHOW_ALERT('COMMON_ALRT');
			:CUS_SUPP.CS_BALANCE:= NVL(:CUS_SUPP.CS_BALANCE,0) - PBAL;
			SET_ALERT_PROPERTY('COMMON_ALRT', ALERT_MESSAGE_TEXT, 'CURRENT BALANCE ='||:CUS_SUPP.CS_BALANCE);
			ALRT := SHOW_ALERT('COMMON_ALRT');
		END IF;
	END IF;
	
END;

[EDITED by LF: applied [code] tags]
[EDITED by DJM: split overly long line]
  • Attachment: CUSTOMER.JPG
    (Size: 42.58KB, Downloaded 130 times)

[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 Go to previous messageGo to next message
Littlefoot
Messages: 20824
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account 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 Go to previous messageGo to next message
allianz2010
Messages: 101
Registered: October 2009
Location: Pakistan
Senior Member

Thanks for reply.....

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 Go to previous messageGo to next message
Littlefoot
Messages: 20824
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account 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 Go to previous messageGo to next message
allianz2010
Messages: 101
Registered: October 2009
Location: Pakistan
Senior Member

Sir thanks for your reply...

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 Go to previous messageGo to next message
Littlefoot
Messages: 20824
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account 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 Go to previous messageGo to next message
allianz2010
Messages: 101
Registered: 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...

thanks for reply...
Re: Problem in calculation in form 6i [message #440132 is a reply to message #440108] Thu, 21 January 2010 04:36 Go to previous messageGo to next message
Littlefoot
Messages: 20824
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account 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 Go to previous messageGo to next message
cookiemonster
Messages: 12320
Registered: 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 Go to previous messageGo to next message
Littlefoot
Messages: 20824
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account 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 Go to previous messageGo to next message
allianz2010
Messages: 101
Registered: 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 Go to previous messageGo to next message
Littlefoot
Messages: 20824
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account 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.
Menu? What 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 Go to previous messageGo to next message
allianz2010
Messages: 101
Registered: October 2009
Location: Pakistan
Senior Member

[/quote]Menu? What menu?
[/quote]

thanks for your reply..

i create a menu bar...

and i call it through Menu....
i attached herewith screen...
  • Attachment: chkmenu.JPG
    (Size: 82.60KB, Downloaded 122 times)
Re: Problem in calculation in form 6i [message #440188 is a reply to message #440164] Thu, 21 January 2010 09:00 Go to previous messageGo to next message
allianz2010
Messages: 101
Registered: 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...

please sir....
Re: Problem in calculation in form 6i [message #440220 is a reply to message #440188] Thu, 21 January 2010 12:40 Go to previous messageGo to next message
Littlefoot
Messages: 20824
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
A whole project ./fa/1688/0/

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)?

Also, what aboutLF
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 Go to previous messageGo to next message
allianz2010
Messages: 101
Registered: October 2009
Location: Pakistan
Senior Member

Thanks for your reply...

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......


i send your my total menu screen
  • Attachment: MENUBAR.JPG
    (Size: 62.49KB, Downloaded 116 times)

[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 Go to previous message
Littlefoot
Messages: 20824
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account 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: Sat Sep 24 18:05:30 CDT 2016

Total time taken to generate the page: 0.07930 seconds