3 Replies Latest reply on Jul 14, 2011 9:17 AM by philmodjunk

    Duplicating and Archiving Records via Radio Button Value

    JordanBravo

      Title

      Duplicating and Archiving Records via Radio Button Value

      Your post

      Hi,

      I have created a phone sheet database in FileMaker Pro 9 with Radio Button values.  Once a call is marked as "DONE" I would like to move the entire record to an Archive database - to keep a record of all calls.  I don't know how, once the button is marked "DONE", to REMOVE the record from the original database and ADD the record to the Archive database. Please advise.

      Thank you much!

      Jordan

        • 1. Re: Duplicating and Archiving Records via Radio Button Value
          TSDuck

          Hi Jordan Bravo:

          Thanks for posting.

          In FileMaker Pro 11, the script trigger feature would allow you to click the radio button and execute a script.  For FileMaker Pro 9 though, you could add an invisible button overtop of your radio button field.  This button would then set the status to done and execute a script for archiving your records. 

          First, you need to setup a script in your main database that will isolate the record, import the record into the archive database, then delete the record from the main file.  Here is a sample script you can use to achieve this.

          Set Variable [ $ID; Value:table::primarykey ]

          Go to Field [table::status]

          Set Field [table::status; “done”]

          Enter Find Mode [ ]

          Set Field [ table::primarykey; $ID ]

          Perform Find [ ]

          Perform Script [ “import” from file: “archive.fp7” ]

          Delete Record/Request [ No dialog ]

          This script will set the status to done, then use a find to isolate your record.  Next, the script will run an import script from your archive database.  Finally, it will delete the record from your main database.  You will also need to add an import script into your archive database that should look like the following.

          Import Records [No dialog; “main.fp7”; Add; “Windows ANSI”]

          Once your scripts are setup, you need to add an invisible button overtop your radio button.  Set the button to perform the find script, then on your layout format the button so it has no fill and no border.  Go to the section “Creating buttons” in the knowledgebase article below for further detail.

          http://help.filemaker.com/app/answers/detail/a_id/3936

          TSDuck

          FileMaker, Inc.

          • 2. Re: Duplicating and Archiving Records via Radio Button Value
            JordanBravo

            Thanks TSDuck!  But I am truly a layman and still having trouble figuring out how to program the script that you had suggested.

            Here is what my script looks like:

            Set Variable [ $ID; Value:"PhoneSheet::primarykey" ]

            Go to Field [PhoneSheet::Status]

            Set Field [PhoneSheet::Status[“DONE”]]

            Enter Find Mode [ ]

            Set Field [ PhoneSheet::Status[$ID]]

            Perform Find [ ]

            Perform Script [ “Import Record” from file: “ArchivePhoneSheet.fp7” ]

            Delete Record/Request [ No dialog ]

            I couldn't figure out how to add a ';' without recieving an error message. Are you able to tell me where I went wrong?

            • 3. Re: Duplicating and Archiving Records via Radio Button Value
              philmodjunk

              Set Variable [ $ID; Value:"PhoneSheet::primarykey" ]  Remove the quotes here and use your table and field names in place of those used here.

              Set Field [PhoneSheet::Status[“DONE”]]

              Set Field [ PhoneSheet::Status[$ID]]

              I couldn't figure out how to add a ';' without recieving an error message. Are you able to tell me where I went wrong?

              When Setting up Set Field, there are two Specify buttons that must be clicked. To get Set Field [Table::Field ; Expression], add set field to your script and click the first button (specify target field). Select Table::Field from the list of fields. Click OK. Now click the lower specify button (calculated result) and create the expression to the right of the semicolon (;). Do not try to type in the semicolon.