3 Replies Latest reply on May 11, 2012 9:27 AM by TSGal

    Delete related records relation applied to all open files

    s-kelsey@nicnet.co.jp

      Summary

      Delete related records relation applied to all open files

      Product

      FileMaker Pro

      Version

      FileMaker Pro 11 Advanced 11.0v3

      Operating system version

      Windows 7, Windows Vista, Windows XP

      Description of the issue

      A file containing tables that do not have the "Delete related record..." option enabled will have it applied when another file that references the two tables and has a "Delete related record..." relationship is opened in FileMaker at the same time as the file without the relation.

      Steps to reproduce the problem

      1. Create a file called "Main" with two tables, "Header" and "Details".
      2. Create an ID field in Header and a HeaderID field in Details.
      3. Make a new record in Header and set a value of "1" in ID.
      4. Make a new record in Detail and set a value of "1" in HeaderID.
      5. Create a new file called "Reference" and add the first file "Main" as a data source.
      6. Add occurrences of the Header and Detail tables to the "Reference" file. Join the two occurrences via the ID and HeaderID fields and enable the "Delete related records..." for the Detail table occurrence. (deleting a record from Header will delete a record from Detail)
      7. With both "Main" and "Reference" opened in FileMaker, select "Main" and delete the record created in 3. from the Header table. This should also delete the record from Detail.

      Expected result

      Only the record from Header should be deleted since the file/layout from which the record was deleted ("Main") does not contain any relation between the two tables.

      Actual result

      Any records from Detail that are related to Header (via the relationship in "Reference") are deleted.

      Exact text of any error message(s) that appear

      none

      Workaround

      Having only "Main" opened in FileMaker will not cause the records in Detail to be deleted.

        • 1. Re: Delete related records relation applied to all open files
          TSGal

          s-kelsey:

          Thank you for your post.

          If "Reference" is open, then the relationship between Header and Detail with "Delete related recordis in this table when a record is deleted in the other table" is active, so if a record is deleted from Header, it will delete the related record from Detail.  With "Reference" not open, the "Delete related records" is not active because Main does not relate to Reference.

          TSGal
          FileMaker, Inc.

          • 2. Re: Delete related records relation applied to all open files
            s-kelsey@nicnet.co.jp

            Thank you for your reply, however it is completely different than my current understanding of table occurrences and base tables.

            As an example, within the same file I can create table occurrences A and B without "Delete related records", and create another set of occurrences A' and B' with "Delete related records", and the delete related records will apply when I delete records from layouts using A' or A. I would think it would only apply when deleting records from A' because only the A'B' relation is checked. Why does a check not appear in the AB relation when I set it in the A'B' relation? I haven't tested yet as of writing this, but do the "Allow creation" and "Sort" also apply to all occurrences (and open files) as well?

            I was under the impression that the settings of a relationship only applied to that relationship. In what cases is having the settings apply to all open files of benefit? Is it a side effect of the internals or FileMaker? I guess these are the questions I'm trying to answer.

             

            Stephen

            • 3. Re: Delete related records relation applied to all open files
              TSGal

              s-kelsey:

              With just "Main" open, the Relationships graph shows "Header" and "Detail" linked together without the option to delete records.  There is no table occurrence displayed for "Reference".

              When "Reference" is opened, the Relationships graph shows "Header" and "Detail" linked together with the option to delete records in "Detail".  Therefore, when you delete a record in "Header", although "Main" doesn't show the option to delete records, "Reference" does show the option, so the recod is deleted in "Detail".

              Without "Reference" open, there is no reference (no pun intended) in Main to access "Reference" and delete the record, so only the record in "Header" is removed, and not in "Detail".

              TSGal
              FileMaker, Inc.