2 Replies Latest reply on Dec 15, 2010 11:15 AM by CraigFiore

    Import Script

    CraigFiore

      Title

      Import Script

      Post

      Hello,

      Im not sure the best way to handle this situation. So, Im looking for some help. I have two separate data base FMP files. One is "Purchase Orders",and the second is "Inventory". I want to keep them separate because the Inventory will not always be used. We will only use that on big jobs.

      The "PO" data base is strictly for purchasing material for jobs. The Inventory database is used to track how much material is on each building and to track how much is used on a certain size building. Sometimes we get jobs up to 50 buildings. A lot of times, material will be moved from building to building after it has been ordered.

      What I would like to do is type in a PO number into my Inventory database and have the data from just that PO import over to the Inventory data base. I would like to keep it down to one click of a button.

      Any Ideas?

        • 1. Re: Import Script
          philmodjunk

          People often want to "keep the data separate" by using separate database files or separate tables within the same file. While that works, it is often an approach that makes life more complicated when you find you need to move or copy data from one to the other. Putting your data all in the same system of tables and using FileMaker's tools for controlling what data is accessible is very often a much simpler and more flexible approach.

          That said, I can give you a basic outline of the script. The details depend on the structure of your Inventory and PO database tables.

          Create a script in Inventory that uses Perform Script to call a script in PO. This first script will pass the typed in PO number to the script in the PO database as a script parameter. The script in PO will use that number to find the needed records in PO. You may need to perform this find on more than one table in PO--depending on your database design. In Inventory, your original script's next step is to use Import Records to copy the data in the found sets thus produced into corresponding tables in Inventory.

          (You can also define relationships between tables in the two files and use that relationship to move data from PO one record at a time in a loop.)

          If you use Import Records in a script, it is much safer to use the matching field names option if at all possible as this eliminates a risk of a long standing bug from causing serious problems with your data should you modify the design of one of the tables referenced in your import.

          For More Information see:    Data loss bug : Spontaneous and erroneous import matching of new fields in specified imports !

          This is one of many acknowledged bugs that can be found in the Known Bug List here in the Report an Issue section of the forum.

          It can also be downloaded as a database file from:   http://www.4shared.com/file/8orL8apk/FMP_Bugs.html

          • 2. Re: Import Script
            CraigFiore

            Thanks for your help. I will take your advice and before I tackle that script I will review my design. It may be easier to do it all in one file.

            Thanks