2 Replies Latest reply on Dec 3, 2010 4:59 AM by disabled_Ed-Case

    Applescript find requests in calculation fields

      Summary

      Applescript find requests in calculation fields

      Product

      FileMaker Pro

      Version

      8, 9, 10, 11

      Operating system version

      Mac OS X 10.4, 10.5, 10.6

      Description of the issue

      I use applescript to query my databases and list results. The usual way of addressing them is by window and find request: e.g.

      tell application "Filemaker Pro"
      try
      delete every request of window "MyDatabase"
      end try
      create request of window "MyDatabase" with data {"my search"}
      find of window "MyDatabase"
      end tell

      This works fine on any indexed field apart from a calculation field - an error of "write access denied" results.
      In my case such calculation field would be a concatanation of a number of other text fields - but sometimes their data has been in some way edited (for instance by limiting the max. number of words to say 10). Therefore I cannot simply write a number of queries for each find to accomodate these fields concatanated into my calculation field.
      Simple question: what's the solution?

      Steps to reproduce the problem

      Try this applescript:

      tell application "Filemaker Pro"
      try
      delete every request of window "MyDatabase"
      end try
      create request of window "MyDatabase" with data {"my search"}
      find of window "My Database"
      end tell

      where the search is to be carried out on a calculation field (text, indexed)

      Expected result

      A find request that results in a number of (or no) records

      Actual result

      error message of "write access denied"

      Exact text of any error message(s) that appear

      Filemaker Pro got an error: Write access denied

      Configuration information

      My calculation field is made up of 3 text fields:
      Field A: limited to a max. of 10 words
      Field B: all words
      Field C: all words

      It should also be noted that the resulting error is precisely the same with no limit on any of the fields to be concatanated. i.e. this occurs with ANY calculation field

      Workaround

      There is none, as it is impractical on a database of 500,000+ records to create a new non-calculation field into which the desired concatanated fields can be written... the data changes often, it's time consuming and fundamentally it's unworkable etc.

        • 1. Re: Applescript find requests in calculation fields
          TSGal

          Ed-Case:

          Thank you for your post.

          This did produce an error prior to FileMaker Pro 10, but this should work with FileMaker Pro 10 and FileMaker Pro 11.

          Let's simplify this a bit further.  Try having only your one file (MyDatabase) open and try the following modified Applescript:

          tell application "FileMaker Pro"
          try
          delete every request
          end try
          create request
          set field "MyCalculation" of request 1 to "my search"
          find
          end tell

          -----

          Keep me posted with any progress.

          TSGal
          FileMaker, Inc.

          • 2. Re: Applescript find requests in calculation fields

            Thank you, TSGal. I thought my query had been ignored.

            I have tried your suggested applescript (and even my posted script) with v11 and everything seems to work according to plan... with the exception of the unhappy combination of my Mac(s) and Filemaker Pro Advanced 11.0.1 or 11.0.2 - both versions of which I found to be rather fragile in the stability department, which is why for all these years I have continued to use v9.03.

            Anyway, Filemaker stability issues and my other complaints about v10 and 11 (vis, the stupid status area that now takes up a quarter of the screen and buggers up all my carefully layouts moan moan etc.) are not for this query, which I am happy to report has been answered. I am grateful to Filemaker Inc.