IF "Consumer Disbursement"."Transaction Type" = "Consumer Disbursement"."Transaction Type"::Receipt THEN BEGIN TotalAmountReceipt := "Consumer Disbursement".Amount + TotalAmountReceipt; END ELSE IF "Consumer Disbursement"."Transaction Type" = "Consumer Disbursement"."Transaction Type"::Cheque THEN BEGIN TotalAmountCheque := "Consumer Disbursement".Amount + TotalAmountCheque; END; "Remaining Balance" := TotalAmountCheque + TotalAmountReceipt;
Answers
Looks like you would like to sum up some lines.
Here's how we did it in 2005.
viewtopic.php?f=14&t=7692
Did you look at the Deposits. I'm sure it acts just as you wish & you can see how that was accomplished.
There also appears to be no need to distinguish between the types. They are already either (+/-) so just totaling the amount field & subtracting the header value should do the trick.
http://www.BiloBeauty.com
http://www.autismspeaks.org
It compiles perfectly, but when i try to run the form it gives me the error: Both target and source must refer to the same table.
Any idea what I might be doing wrong..
The error seems to be caused by this line:
"Consumer Disbursement".COPY(REC);
You have to figure out which table is holding the "lines".
you need to call the function from the amount field.
Forget about the header for now & subtracting the "Annual allocation"
Just try to total the fields and see how that goes.
I know in my deposits - I enter a total amount received and I can allocated that full amount to different customers and it subtracts from the Deposit total to show you how much is left. It's so easy to review how it was already done somewhere else in nav and follw that as an example.
http://www.BiloBeauty.com
http://www.autismspeaks.org
viewtopic.php?f=23&t=26411
this is based on the General Journal Line table - just substitute you line table.
http://www.BiloBeauty.com
http://www.autismspeaks.org
I am not sure why its still throwing the error. Also, would I have to call this function from the OnAfterGetCurrRecord trigger ????
& http://msdn.microsoft.com/en-us/library/dd301396.aspx
http://www.BiloBeauty.com
http://www.autismspeaks.org
The only Issue that I am having is that whenever I add a new line to my subform, I have to click on the ES Card (header) for it to update the Remaining Balance. Is there a way I can have it update itself, without having to click anywhere else.
Just as a point you don't seem to follow examples.
In the example a new Global Record was used "GenJnlLine" notice it was not "Gen. Journal Line".
you've been given all you need to complete the task. Have you even taken a look at how deposits work?
just sayin
http://www.BiloBeauty.com
http://www.autismspeaks.org
What can I do, so that it would update the remaining balance right away.
Simple.
Delete everything you have done so far then go back and read the help that was provided to you. If you don't follow the help that people give you have can you expect to benefit form that help.
I followed the way you suggested, with minor changes. Now it calculates the remaning balance, but I have to go the next line before it updates the field. Is there any other trigger that I need to call the function from so that it would update it right away (as soon as i press enter). So far the function is being called from OnAfterGetCurrRecord trigger.
If this is a serious requirement, you can try to extend the amount validate with a MODIFY statement, as described in viewtopic.php?f=23&t=52091