3 Replies Latest reply on Feb 11, 2014 10:59 AM by philmodjunk

    Automate copy and paste of data from one file to another using a button and script

    FranciscoMainou

      Title

      Automate copy and paste of data from one file to another using a button and script

      Post

           Intro:

            

           Hi, I am working on a data base for medical records called: “PersonKjema”. It contains information on different examinations of a given patient and also basic information such as: ID-number and Full-name.

            

           Separately, I have other databases files to type the results of medical Test, for example:

            

           “Flue TEST”

           “Ultrasound Test”

            

           When clicking on File>Manage>Database , I import those tests and set relationships of fields like the ID-number and Full-name in the “PersonKjema” file and vice versa. I also click on the option: “allow creations of records when…” and “delete records when…” in order to relate fields.

            

           Problem:

            

           When opening “PersonKjema” file, I want to use a button that performs a script in order to open one of the test “FLUE TEST” (for example) and automatically take the ID-number and full name of the patient (present Record)  and paste on the “FlueTest” then I will type information of the test itself.

            

           My wrong Solution:

            

           I set up the button to perform a script called: “OPEN FLUE TEST” and I set the script to do:

           Copy [selectet; Personkjema: ID-number]

           Open File [Flue Test]

            

           But it seems not working. I have been analyzing an similar example from an old data base that we have and it works , but I am afraid , I am missing something to do this extraction of some data from the current record of a data base into a another one.

            

           Any suggestion?

            I have also added a line Paste [selectet; Personkjema: ID-number], but not improvement at all.

        • 1. Re: Automate copy and paste of data from one file to another using a button and script
          philmodjunk

               Copy is rarely the best script step to use to move data from one table to another.

               Is "Flue Test" a FileMaker database file?

               If so, why is it a separate file? Why not define a table for flue test data in your Medical Records File?

          • 2. Re: Automate copy and paste of data from one file to another using a button and script
            FranciscoMainou

                 Yes. "Flue Test" is another filemaker pro Database. The reason why is a separately file, it is because the database "PersonKjema" (main) has been used since 2009 to compute medical records and it contains hundreds of fields and records already. "Flue-Test" as other new Tes or flies, are Medical R&D for statistics and are used only with some of the patients and used from this year; therefore it was decided to have it as a different file.

                 "Personkjema" File contains also some other test-files for exmaple "OLD flue-Test" (filamakerpro) that was used for patients in 2011 ofr example, and there those buttons perfoms and scrip similar to what I want to do. By inspecting the buttons , tables, fields and relationships I have been managing to update functionality for the new tests we want to add, and Copy function has been used there. It may be that I am missing somthing when trying to leanr by exploring old scripts.

                  

                  

            • 3. Re: Automate copy and paste of data from one file to another using a button and script
              philmodjunk

                   it contains hundreds of fields and records already.

                   Which does not mean that you can't add an additional table to the file. You would not add these fields/records to the existing table.

                   Using a separate file complicates your design.

                   What version of FileMaker are you currently using?

                   And please note that even with the table in a different file, you can still define a relationship between the table in one file and the table in another file by setting up an external data source reference.