AnsweredAssumed Answered

AppleScript to get the value of a Summary cell (sum)

Question asked by Phrogz on Apr 11, 2010
Latest reply on Apr 12, 2010 by Phrogz

Title

AppleScript to get the value of a Summary cell (sum)

Post

I have a legacy DB running on FM7 with a single table ("Main"). One of the fields in this table is "Price" (a Number), and another field is "Total Price" (a "Total of" the Price field).

 

When I use the Total Price field in a Layout with a Trailing Grand Summary section, it shows me what I want: the total value of the Price field for all found records. However, when I use AppleScript to ask for the value of this cell, it consistently gives me a wrong answer:

 

tellapplication "FileMaker Pro"

   getcell "Total Price" ofdatabase "FooBar"

     --> "212617448.616"

end tell

 

This same number is returned regardless of the layout used, whether in Browse or Preview mode, and regardless of what the Total Price cell is actually showing on screen.

 

This mechanism used to work, under some combination of previous OS X release/FM version. I rather urgently need to get it fixed again. More exactly, I need some automated way to query the Main table to find all records matching four criteria and get the sum of the Price field for the matching ones, and then copy that value into an Excel file. (I need to do this 70 times for each month to be transferred, usually transferring several months at a time every couple of weeks. This is why it needs to be automated.)

 

Thanks in advance for any help you can give me.

 

OS X 10.6.3

 

FileMaker Pro 7.0v2 (local only: not networked, not published to web); willing to upgrade if someone feels rather certain the problem is inherent to FM7 and fixed as of FM11.

 

Oh, and finally, I will note that I have found a way to get the correct value:

tellapplication "FileMaker Pro"

   telldatabase "FooBar"

     setltolayout "Bob"

     setmtofirstitemofl

     setntolastitemofm

      --> "$54,696.49"

   endtell

endtell

 

However, this value needs a small amount of massaging to turn it into a number (not a showstopper), and does not work when the result of querying for the four criteria returns no records (making it useless).

Outcomes