1 Reply Latest reply on Oct 19, 2010 10:09 AM by philmodjunk

    Creating new record in a second file



      Creating new record in a second file


      Hi - Thanks in advance to anyone who can help with this. I am a beginner level FileMaker programmer who has been asked to solve this problem:

      There is an existing filemaker system with a database containing customer information. The company is starting a second, related business, and needs to keep the data from the second business in a separate file. Some customers for the second business will be customers from the first business; other customers will be new.

      A couple of questions:

      1. I can set up the new file, but am confused as to whether the tables are "related" in the Filemaker world. There will be similar fields (name, address), but many of the records in the new table have no corresponding records in the old table. I have created table occurrences in each of the files, but haven't created any relationships.
      2. I am trying to write a script in the old table that will create a new record in the new file, and then copy some of the information from the old file. The script doesn't work in the way I intended - it opens the new file, but creates a blank record in the old file. What am I doing wrong?

      Set Variable ($$name; Value":BusinessOne::BusinessOneName)

      Open File ("BusinessTwo")

      New Record/Request

      Set Field [BusinessTwo::BusinessTwoName; $$name]

      Commit Records/Requests[]

      As I said, I am a novice at this and would appreciate help from anyone who has the patience to walk me through the problem! Thanks

        • 1. Re: Creating new record in a second file

          You might need to rethink your entire premise here. Contacts from both companies could easily be kept in the same table. Unless the data is kept on physically separate systems that aren't on the same network, there are many strategies that can be implemented with FileMaker to keep the data in two separate groups and access permissions can also be set up so that a user who needs to see data for business #1 but isn't authorized to see data for business #2 can use the database to work with Business #1 data and yet cannot see any unauthorized data for business #2.

          To explain while your script didn't work, your global variable $$name isn't given a value anywhere in your script. Unless some other action uses Set Variable to put a value in this variable, your script creates a new record, but the set field step is setting an empty field to an empty value which produces your new blank record.

          Set Variable [$Name ; Yourtable::NameField]
          Open File ("business two")
          New Record/Request
          Set Field [Businesstwo::businesstwoname; $Name]