4 Replies Latest reply on Dec 19, 2011 10:35 AM by mgores

    Not updating fields from a related set on a master layout

    johannes

      Title

      Not updating fields from a related set on a master layout

      Post

      Dear all,

      I am new to Filemaker though not new to relational databases and programming. I am using Filemaker Pro 11 and have set up a test database with the following information:

       

      customers table with fix customer details like birthday. 

      . ID (uniquely identifies every customer record)

      . ID_address (link to the default customer address)

      addresses table with variable customer addresses. 

      . ID (uniquely identifies every address record)

      . ID_customer (link to the customer record for which this address is the default)

       

      There is a relationship with

      - customers::ID linked to adresses::ID_customer and 

      - customers::ID_address linked to addresses::ID

       

      The customer layout holds these fields:

       

      . customers::ID

      . customers::name

      . customers::ID_address (dropdown box with value list 'select_address')

      . addresses::street_address

      . addresses::zip

      . addresses::city

       

      The value list uses as the first field: addresses::ID and as the second field: addresses:city.

      The problem is now that the address data on the customer layout is not updated when the selected value of the dropdown box changes. 

      I have done tests with 'include all values' and it seemed to update the information at first, but now it doesn't anymore. With 'include only related values starting from 'customers' it never updated the information.

       

      I seem to misunderstand the way this works. Can someone point me to the mistake I am making?

       

      Thanks in advance for any help.

       

      Hans

        • 1. Re: Not updating fields from a related set on a master layout
          mgores

          It looks like you have two relationships 

          customers::ID = adresses::ID_customer  and customers::ID addresses = adresses::ID

          Are these two different relationships or both defined in one relationship?

          If they are both defined in one relationship, both have to be matching to get your data to display.  To get them to fill out on the layout you described, remove the customers::ID = adresses::ID_customer from the relationship.

          • 2. Re: Not updating fields from a related set on a master layout
            johannes

            Hi Mark,

             

            Thanks for your reply. I removed the second link from the relationship. So it now has just customers::ID = addresses::ID_customer.

            The result is the same. The selected addresses:ID is stored in the customers record but the address coming from the addresses table is not changed on the customers layout when the selection in the dropdown box changes.

            It seems that there is something conceptually wrong here. 

            The desired task is to select, on the customer layout, one of more addresses for customer displayed and the question is: Is the relationship in cooperation with a value list in a dropdown box the correct way to achieve this? It seemed convenient but is it the intended way to do this?

            I have attached a screenshot to demonstrate that the address information is not updated with the selection in the dropdown box.

            Your thoughts will be very much appreciated.

             

            Thanks

            Hans

            • 3. Re: Not updating fields from a related set on a master layout
              johannes

              Hi again Mark,

              problem solved. I just got the answer in a forum post of Filemakertoday. Here it is for the records (maybe someone later on has similar problems):

               

              You need two relationships to Addresses: one which shows all child records of customers (this powers your dropdown list of relevant addresses, showing only addresses of this customer, and of course lets you enter new addresses in a portal etc etc); and one which ONLY shows the SINGLE related record based on the SPECIFIC address ID that you selected.

              Add a new table occurrence of Addresses, let's call it SelectedAddress, to your relationship graph and set up the relationships accordingly; display that one where you wish to see the selected address, rather than via the original relationship

              Thanks again for taking the the time to respond.

              Best regards

               Hans

               

               

               

              • 4. Re: Not updating fields from a related set on a master layout
                mgores

                Hans,

                My mistake earlier.  The way you are selecting it you would want the customers::ID addresses = adresses::ID relationship.

                The drop down selection should be for the customers::ID addresses field and then should cause the address fields to update.

                And yes, to create the value list or portal for selecting from all address you would need a second table occurence with a cartesan (X) relationship.

                 

                If you wanted to possibly have more than 1 address per customer or more than 1 customer per address, I would recommend adding a third (join) table, which could map any contact(s) to any address(es).