3 Replies Latest reply on Feb 10, 2013 2:55 PM by rbogdanoff

    scripting question


      New at Filemaker scripting syntax. I have a table called DONORS, and a related table of all their donations as individual records called DONATION, linked by a key field donorID. I can get the sum of all donations with a calculation field in the DONORS table: Sum (DONATION::amount)


      How (and where) do I create a calculation field to show the sum of all donations for each donor for a particular year. I tried creating a field in the DONORS table and tried this calculation which did not work:


      If (Year (DONATION::gift date) = 2012);

      Sum (DONATION::amount); 0)


      Thanks in advance for any help.

        • 1. Re: scripting question

          Not really a scripting question...

          ...in the DONATIONS table create a SUMMARY field = total of the numeric donation amount field. That summary field can be used in a LIST view in a 'layout part' called a subsummary, and depending on what the subsummary field is sorted on, say, YEAR, then you would get an amount for each different year, and if you create another layout part called a trailing (or leading) grand summary, you will get a total for the DONOR (based on a multipredicate sort of DONOR / YEAR.)

          • 2. Re: scripting question

            There are a couple of ways to do this. To avoid going into LIST view to see the total by year, and to avoid having to sort the table to see the result, I would set up a second link between DONOR and DONATIONS (click on the plus sign in the relationships window, and set up DONATIONS 2). This link will use both the donorID fields in both tables, and the year of donation in the DONATIONS table with a flield in the DONOR table that you can put any year you like into. The calculation Sum(DONATION 2::amount) will then give you what you want; any year you put into the field in the DONORS table will show you the total for that year.


            Does this cover what you were looking for?



            • 3. Re: scripting question

              Thanks for this info, I'll try it as soon as I'm back in the office on Tuesday.




              Sent from my iPad