Home » Developer & Programmer » Forms » datablock item is not getting updated? (Forms 6i,Oracle 9i)
datablock item is not getting updated? [message #428572] Wed, 28 October 2009 23:17 Go to next message
mm_kanish05
Messages: 487
Registered: January 2007
Location: Chennai
Senior Member

Hi,

I have a datablock(BillMain) and it have lot of items. One of item is Paid_Amount.

I am using the following coding on when-button-pressed of save button.


If :BillMain.DB_Amount > 0 Then
	 If :BillMain.DNRemarks is Null Then
	 	  Message('DN Amount > 0.  DN Remarks is Null !!');
	 	  Raise form_trigger_failure;
	 End if;
End if;	 
If :BillMain.CR_Amount > 0 Then
	 If :BillMain.CNRemarks is Null Then
	 	  Message('CN Amount > 0.  CN Remarks is Null !!');
	 	  Raise form_trigger_failure;
	 End if;
End if;	 

If :ClosedYear = 'Y' Then
	 Message('Saving records for Closed Financial Years not permitted !!');
	 Raise form_trigger_failure;
End if;

PickAPNo;

If :Ap_DocumentDate < :PoDate Then
   Message('Bill Passing Date < Job Order Date !!');
   Raise form_trigger_failure;
End if;

If :BillMain.Advdocno is Null Then
   AdvanceChk;
End if;

UpdateLedger;

If Nvl(:BillMain.TDS_Amount,0) > 0 Then
   UpdtTDSData;
End if;

Update LastDocs Set Serial_Number = To_Number(Substr(:BillMain.AP_DocumentNo,5,4)),
                    Doc_Date      = :BillMain.AP_DocumentDate
              Where Periodid      = :Global.Periodid
                and Doc_Type      = :Prefix || :APDType
                and Unitid        = :Global.Unitid;

If :BillMain.Db_Amount > 0 Then
   MakeDbNote;
End if;

If :BillMain.Cr_Amount > 1 Then
   MakeCrNote;
End if;

if :BillMain.Advdocno is null then
    null;
else
   adv_selection;
end if;



If :Billmain.Advamt is Not null Then
	If Nvl(:BillMain.Advamt,0) > Nvl(:BillMain.Ap_amount,0) Then
		 :Billmain.Paid_Amount := Nvl(:Billmain.Paid_amount,0)+(Nvl(:BillMain.Ap_amount,0) - Nvl(:BillMain.TDS_Amount,0));
		 Message('tds Amount'||:Billmain.TDS_Amount);
		 Message('AP Amount'||:Billmain.AP_Amount);
		 Message('Paid Amount'||:Billmain.Paid_Amount);
	Else
		 :BillMain.Paid_Amount := Nvl(:Billmain.Paid_Amount,0)+Nvl(:BillMain.Advamt,0);
		 Message('Paid Amount'||:Billmain.Paid_Amount);
	End If;
End If;

do_key('commit_form');

Go_Item('apmenu.Clear');



Specifically the following is not getting changes


If :Billmain.Advamt is Not null Then
	If Nvl(:BillMain.Advamt,0) > Nvl(:BillMain.Ap_amount,0) Then
		 :Billmain.Paid_Amount := Nvl(:Billmain.Paid_amount,0)+(Nvl(:BillMain.Ap_amount,0) - Nvl(:BillMain.TDS_Amount,0));
		 Message('tds Amount'||:Billmain.TDS_Amount);
		 Message('AP Amount'||:Billmain.AP_Amount);
		 Message('Paid Amount'||:Billmain.Paid_Amount);
	Else
		 :BillMain.Paid_Amount := Nvl(:Billmain.Paid_Amount,0)+Nvl(:BillMain.Advamt,0);
		 Message('Paid Amount'||:Billmain.Paid_Amount);
	End If;
End If;


Billmain.Advamt = 5300
Billmain.Ap_amount = 1220
BillMain.Tds_Amount = 24
BillMain.Paid_Amount = 24 (Previous changes) but the above changes is not getting effect . Please help what it may be the problem.

kanish
Re: datablock item is not getting updated? [message #428605 is a reply to message #428572] Thu, 29 October 2009 02:24 Go to previous messageGo to next message
Littlefoot
Messages: 20827
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Put MESSAGE / PAUSE pairs into the code in order to follow trigger execution. When convenient, display variables' (or items') values so that you'd know what is going on. Hopefully, you'll find which part of the code does not execute (and prevents your item to be updated).
Re: datablock item is not getting updated? [message #428614 is a reply to message #428572] Thu, 29 October 2009 02:40 Go to previous messageGo to next message
mm_kanish05
Messages: 487
Registered: January 2007
Location: Chennai
Senior Member

Thanks for the reply LittleFoot.

I solved my problem.

Actually before proceed for save button, the control on TDS_Amount field (Billmain block). But the Save Button having the previouse mail code.

Key-next-item of Tds_amount

:Billmain.Paid_amount := :Billmain.Tds_Amount;

So the tdsamount only i got instead of the above code impact.

One More question

When the key-next-item execute

when i move the control from the field(having key-next-item) to next block item (like button on next block)

block 1- item 1 -key-next-item
block 2 - button - when-button-pressed

i need the execution order

kanish


Re: datablock item is not getting updated? [message #428631 is a reply to message #428614] Thu, 29 October 2009 04:16 Go to previous messageGo to next message
Littlefoot
Messages: 20827
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I don't quite understand ... KEY-NEXT-ITEM will fire when you navigate to the next item (by pressing <Tab> or <Enter> keys, for example). WHEN-BUTTON-PRESSED trigger fires when you, well, press the button.

So - what execution order are you talking about? (Anyway, if you are uncertain, do that as I've already said: put MESSAGE into both triggers and you'll see which one fires first).
Re: datablock item is not getting updated? [message #428634 is a reply to message #428572] Thu, 29 October 2009 04:25 Go to previous messageGo to next message
mm_kanish05
Messages: 487
Registered: January 2007
Location: Chennai
Senior Member

Block A
Item 1
Item 2
Block B
Button 1
Button 2

Now the cursor on BlockA.Item 1 (it having Key-next-item). And Directly i will move to the BlockB.Button1. (It have when-button-pressed)

which is executed 1st

whether Key-next-item or When-button-pressed

But in my form application (Forms 6i)
when-btton-press called 1st and then the key-next-item

can i know why?

kanish
Re: datablock item is not getting updated? [message #428638 is a reply to message #428634] Thu, 29 October 2009 04:30 Go to previous messageGo to next message
Littlefoot
Messages: 20827
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Well, if you are on BLOCK_A.ITEM_1, you'll first have to move to BLOCK_B.BUTTON_1 if you want to execute WHEN-BUTTON-PRESSED trigger on that button.

How do you "Directly move to the BlockB.Button1"? What does "directly" mean?
Re: datablock item is not getting updated? [message #428649 is a reply to message #428572] Thu, 29 October 2009 04:54 Go to previous messageGo to next message
mm_kanish05
Messages: 487
Registered: January 2007
Location: Chennai
Senior Member

using mouse directly click the button

Re: datablock item is not getting updated? [message #428659 is a reply to message #428572] Thu, 29 October 2009 05:35 Go to previous message
cookiemonster
Messages: 12320
Registered: September 2008
Location: Rainy Manchester
Senior Member
If you're using the mouse to navigate then KEY-NEXT-ITEM doesn't get fired AT ALL.

It fires when you press tab to move to the next item. Mouse navigation bypasses it completely. As does using up and down and shift/tab.

You should never use KEY-NEXT-ITEM for anything other than navigation code. You certainly shouldn't be using it to assign values to items.
Previous Topic: Using Excel Lists in Forms10g
Next Topic: Sending Mails thru Oracle Reports(6i or 10g) on Oracle Application Server
Goto Forum:
  


Current Time: Thu Sep 29 19:15:30 CDT 2016

Total time taken to generate the page: 0.06770 seconds