April 18, 200421 yr Hey Everybody, hopefully I'm not repeating a post b/c I looked around but I'm trying to figure out exactly how to use a script to find the sum of some displayed figures... Basically our database is set up for donators of which you can view the history of each particular person or company via a portal with the pertinent information. Basically, I want to write a script for a calculation field found underneath the portal that takes the Amount field from each donation instance in the portal and sums them up and places the grand total in the calculation field "Total". Every script I have tried just adds the values in a horizontal fashion but we need it to go down the list and add those values... any ideas??? Here's an example of what the portal looks like FYI: -------------------------------------------------------------- Donation Type: Cash Amount: 50.00 Date: 03/29/02 Donation Type: Check Amount: 490.00 Date: 05/28/04 -------------------------------------------------------------- (end of portal) Grand Total: 540.00 <-- But I cant get this to sum right...Thanks in advance! FileMaker Version: 7 Platform: Windows XP
April 18, 200421 yr A script isn't necessary, this can be done with a calculation field. In the file that has the portal, and assuming the portal is using a relationship named "PortalRelationship ": define a calculation field and set it to: Sum(PortalRelationship::Amount) Place the calculation field on the layout outside of the portal & Voila! Does this do what you need?
April 19, 200421 yr Author I have tried placing the Grand Total field outside the portal (called "Donations") and Grand Total field is defined as a calculation set to: Sum(Donations::Amount) It will only display the value in the first Amount field. Using Example from above it would only display "$50" , not "$490" or "$540" UPDATE: I have figured out to do this with a script using the "Insert Calculated Result [Donations::Total; Sum(Donations::Amount)]" Though I still don't understand why the above method you suggested isn't working.
April 19, 200421 yr Can you upload your file so I can look at it? I'm not sure what's going on, it may be a FM7 issue I haven't encountered yet in my limited usage.
April 19, 200421 yr I'm still using FM6 and am having a similar problem (see my post), but if it's the same, what I've been doing is creating a new TRIALING GRAND SUMMARY part and putting the Summary field inside a portal in this new part. Works MOST of the time...
Create an account or sign in to comment