4 Replies Latest reply on May 24, 2011 2:45 PM by KBGF75

    FMP9 script won't work in FMP7

    KBGF75

      Title

      FMP9 script won't work in FMP7

      Post

      I’m using FMP9 with a file containing three tables. The Contacts and Donations tables are most used. The main Contact layout (contact data entry) has a button titled “Create New Donation Record.” The related script, shown immediately below, creates a new record in the donations data entry layout. The script has worked well on Windows PCs for several years. Contact records and Donation records are related by a contactID number.

      Recently I tried hosting the file on an old iMac (OS X v.10.3.9) using FMP7. Most other scripts perform normally, but Create New Donation Record does not. When I looked at the script in the iMac file, some of the steps had been corrupted. That appears to be because certain script steps in FM9 are not recognized in FM7. This iMac/FM7 script is shown below at bottom.

      I hope this is enough information for someone to edit the FM7 script so it will do the job on the iMac, or at least point me in the right direction. 

              -Al

      Script 5. create new Donation record  (FM9)

      Set Variable [$contactID; Value:Contacts::contactID_pk]

      Go to Layout ["Donation Data Entry" (Donations)]

      New Record/Request

      Set Field [ Donations::ContactID_fk;  $contactID]

      Perform Find [ ]

      Set Field [Donations::ContactID_fk;  $contactID]

      Perform Find [ ]

      Sort Records [Restore; No dialog]

      Go to Record/Request/Page [ Last ]

      Go to Field [Donations::Date of donation]

       

      Script 5. create new Donation record  (FM7)

      [ "$contactID" ]

      Go to Layout [ "Donation Data Entry" (Donations) ]

      New Record/Request

      Set Field [ Donations::ContactID_fk; <Function Missing><Function Missing>TimestampLnTruncateSqrtExpFactorialLnExp"¥" ]

      Enter Find Mode [  ]

      Set Field [ Donations::ContactID_fk; <Function Missing><Function Missing>TimestampLnTruncateSqrtExpFactorialLnExp"¥" ]

      Perform Find [  ]

      Sort Records [ Specified Sort Order: Donations::Date don. record created; ascending ] [ Restore; No dialog ]

      Go to Record/Request/Page [ Last ]

      Go to Field [ Donations::Date of donation ]

      END MESSAGE

        • 1. Re: FMP9 script won't work in FMP7
          philmodjunk

          Variables and Set Variable weren't part of FileMaker 7.

          You can replace them with references to Global fields in order to get your script to work in FileMaker 7 (Or maybe you shouldn't try using such an old version of FileMaker.)

          Set Field [Contacts::gContactID ; Contacts::ContactID_pk]
          Go to Layout ["Donation Data Entry" (Donations)]
          New Record/Request
          Set Field [ Donations::ContactID_fk;  Contacts::gContactID]
          Perform Find [ restore ]
          Set Field [Donations::ContactID_fk;  Contacts::gContactID]
          Perform Find [ restore ]
          Sort Records [Restore; No dialog]
          Go to Record/Request/Page [ Last ]
          Go to Field [Donations::Date of donation]

          gContactID is a number field you'd define and then specify global storage to make it a global field.

          • 2. Re: FMP9 script won't work in FMP7
            KBGF75

            I added a Global field and revised my script per your advice. The revised script created a new donation record, but finding all donation records with that contact number failed. Error message was “No records match this set of find requests.”

            After some trial-and-error editing, here’s the script that works for me. (Main difference was to replace first Perform Find with Enter Find Mode.)

            Thanks for the help.

                        -Al

            Set Field [ Contacts::gContactID; Contacts::contactID_pk ]

            Go to Layout [ "Donation Data Entry" (Donations) ]

            New Record/Request

            Set Field [ Donations::ContactID_fk; Contacts::gContactID ]

            Enter Find Mode [ ]

            Set Field [ Donations::ContactID_fk; Contacts::gContactID ]

            Perform Find [ ]

            Sort Records [ Specified Sort Order: Donations::Date don. record created; ascending ]

            [ Restore; No dialog ]

            Go to Record/Request/Page

            [ Last ]

            Go to Field [ Donations::Date of donation ]

            • 3. Re: FMP9 script won't work in FMP7
              philmodjunk

              The find won't work unless gContactID has global storage selected for it. I Don't have FileMaker 7, but in later versions, you open Manage | Database | Fields, double click the field's definition, then select Global on the storage tab.

              You may also need to add a commit Record step just before Enter Find Mode []

              • 4. Re: FMP9 script won't work in FMP7
                KBGF75

                The field gContactID was designated for global storage when created. The "find problem" vanished when I replaced the first Perform Find with Enter Find Mode. The script is working well. Thanks again.

                     -Al