Hi Lee,

It sounds like at some times it is refusing to commit the data from the last calculation. Try adding a commit record request step to insure that the global is updated.

I am not sure how your loop goes, but you may also have to build in some mechanism to keep focus on the correct record when doing this.

HTH

Dave McQueen

Forbes,
The script works fine using the same global calculation for many records but sometimes it does not calculate correctly. This has become obvious when running the script many times that on rare occasions it will not work correctly on specific accounts. So I used the debugger and finally found that on some occasions this global field refused to calculate these two figures correctly. I cannot find out why as the very next account the script and this global field work fine. Without going into great detail an amount of money is paid against a client's many outstanding invoices so without having to calculate and pay off each invoice individually the script sorts the outstanding invoices by date then pays all the invoices off until it either runs out of money or the last invoice, if its the correct totaled amount. To do this a loop runs and after each payment it re calculates what is left to pay the next invoice. Its at this time the global filed is holding the amount still available to pay the next invoice and is used to pass the list of error catches to either continue or to exit the script. It works efficiently and perfectly well until some account just refuses to allow the global field to calculate correctly.

Hence my dilemma. I'm going to see if I can do a work around to stop having to use the global field.


Lee Mills

Robertson, Forbes wrote:
Is the problem that you have a global -- and which context is it
referring to? A normal calc field refers to the current record.
Forbes

-----Original Message-----
From: FileMaker Pro Discussions [mailto:[EMAIL PROTECTED]
On Behalf Of Lee
Sent: 10 September 2008 10:58
To: [email protected]
Subject: Help major problem

Hi,
I have struck something I cannot come to grips with. I have a script that uses a global field. That global field is a simple calculation of two figures, payment-amount due. I have a payment figure of $8,932 and an amount due of $198. The difference is obviously $8,734 however the global field displays $8,701 which is $33 different. If I change the global field to a non global field it displays $8,734 the correct figure. When I change it back as a global it again displays $8,701 completely wrong. I have recreate a new global calc field to see if the field was corrupt but every time I create a global field it gives the wrong answer. Has anybody found this before and how do you fix it ? It only does it on some clients not all. Sometimes it displays the correct calculated figure but other times it displays the wrong calculated figure, a totally useless scenario as you would appreciate.

I've never struck this before and its driving me mad for something so simple. The calculation is a 'number' and nothing is changed apart from the field either being a global or a standard calc field but gives a different calculated answer depending on its setting. I have tried this file on both Mac and PC's with the same result, so if you have any ideas please let me know.
FMP9.0v3 mac (Leopard) and PC(XP2)


--

Reply via email to