5 Replies Latest reply on Feb 15, 2010 2:18 PM by onamac

    Field entry in a relation: when entries get deleted question

    onamac

      Title

      Field entry in a relation: when entries get deleted question

      Post

      What is it that determines whether an entry in one table/field will be deleted in the relational main table's field? 

       

      I have the typical relational link from the first table (the ID field) to a second table (its ID field) in order to get that drop down list where I can pick a record's info and have it automatically entered in the second table. This works well. I was using this to enter fields in the second table for testing purposes, which would be temporary. I noticed when I highlighted the field and deleted the text that had been entered (because I was just messing around), it deleted that info in the main table too. When I checked the relationship, I do not have the "delete related records in this table when the record is deleted in the other table" or the "allow creation of records in this table" checked. Is this happening merely by the link from ID Table 1 to ID table 2?

       

      Is there any way to stop this behavior, or just stop testing it out this way!!

       

      Thanks. 

        • 1. Re: Field entry in a relation: when entries get deleted question
          ninja
            

          Are you sure you're DELETING the data?  ...or are you just breaking the link between the tables by deleting the value in your IDfield...?

           

          If you break the link, the related data that appears on your layout won't be related anymore and will disappear from view...this isn't the same as deleting the data.

           

          In much the same way, are you really entering it on the second table, or just creating a link?

           

          'Layout' is not the same thing as 'table' ... 

           

          Can you confirm what is really going on?  Go to table2 and see if the data was really deleted.

          • 2. Re: Field entry in a relation: when entries get deleted question
            onamac
              

            Yes, it was deleted.

             

            Table 1 was where Contacts were entered, having an ID field and a name field. I have a layout for Contacts with those fields where the entries are made.

             

            The related table (table 2) had an ID field and a name field whose entry came from a drop down list (ID data from table 1), which would also fill in the name in the name field. This was a new layout based on the second table.

             

            When I would highlight this name (let's say "Tom Smith") in table 2 and press "delete" on my keyboard, the name in table 1 would also now be empty with no way to get it back other than to retype it in. The drop down list which used to say "1 Tom Smith" now would say "1          ".  When I would look on my Contacts layout, the name "Tom Smith" would be gone, although the record remained. So I'm assuming "Tom Smith" was deleted.

             

            However, I have another two tables where I'm using the drop down scenario, and deleting the name in one table does not delete it in the other. It was this difference in behavior that prompted my question. Since you guys have a wealth of experience with FM, I figured you'd recognize what was going on here; what causes this. When I compared both scenarios, I couldn't find any difference in the setups, but there must have been. Hope this is clearer!

             

             

            • 3. Re: Field entry in a relation: when entries get deleted question
              ninja
                

              Howdy,

               

              Thanks for the further explanation.

               

              Let's check it out to see what might be going on.

               

              Established:

              When you delete text "Tom Smith" in a field in a layout based on Table2, that text is removed from a related record on Table1 and the value list value is also altered.

               

              If the value list is based off of that field in Table1...then it SHOULD get altered...that is consistent, no problem there.

               

              The field you are deleting the value from...does the field name start with '::' in layout mode?  If so, that field is actualyy FROM Table1 and when you delete it (from layout2 or any other) you are deleting the field value from Table1.  Check this out by going to layout mode and seeing what table::field combo is in that spot.  Check it also in your other Dbase to see similarity or difference.

               

              One thing that fits what you've described is that in your OTHER Dbase, the field is a Table2 field set to lookup from Table1, whereas from THIS Dbase, it is actually a Table1 field residing on your Table2 layout.

               

              If that's not it, we'll keep digging...

              • 4. Re: Field entry in a relation: when entries get deleted question
                onamac
                  

                 "The field you are deleting the value from...does the field name start with '::' in layout mode?  If so, that field is actualyy FROM Table1 and when you delete it (from layout2 or any other) you are deleting the field value from Table1. "

                 

                Ah, that's the problem! ::

                 

                I missed that one altogether. Thank you!! 

                 

                 

                • 5. Re: Field entry in a relation: when entries get deleted question
                  onamac
                     P.S. There are so many alternate ways (lookup, value lists, etc.) to accomplish things in FM that I'm still wrapping my head around where and when to use a given solution. Great learning.