8 Replies Latest reply on Oct 5, 2011 2:06 PM by John_1

    Attaching different records to same client

    John_1

      Title

      Attaching different records to same client

      Post

      I am trying to create a layout with name, address, phone numbers etc... on top and underneath I would like to generate different encounters under the same file. Which means subrecords within the same record. Any help. Thanks

        • 1. Re: Attaching different records to same client
          philmodjunk

          What you describe is best implemented with a portal to a related table.

          In manage | Database | Tables you can create a new table, click the fields tab to define fields for it and then click the relationships tab to create this relationship:

          Contacts::ContactID = Encounters::ContactID

          Contacts::ContactID would be defined as an auto-entered serial number field. Encounters::ContactID is a number field with no other options specified. You create this relationship on the relationships tab by dragging from ContactID in one table occurrence box to ContactID in the other. Then you can double click the relationship line this action creates to specify "Allow creation of records via this relationship" for the Encounters table.

          Now you can return to your original Contacts layout and add a portal to Encounters. Thanks to that "allow creation" option, you can log encounters in the portal just by entering data in the bottom blank row of the portal.

          Portals are a very useful, often used layout object in FileMaker. There are a number of different options you can specify for it, so it is a good term to research in FileMaker help and/or any training materials you have in order to learn more about it.

          • 2. Re: Attaching different records to same client
            John_1

            I'll try it out. Is there a way for a newly entered field in the first encounter to be carried along to the subsequent encounters. Shall I add it to the first contact database and create a relationship with the same field in the encounter database? Thanks

            • 3. Re: Attaching different records to same client
              philmodjunk

              There are several approaches possible. What method is best depends one what you are trying to accomplish with this field.

              • 4. Re: Attaching different records to same client
                John_1

                If the first database has: Name, address, home phone number.

                The second database has: Date of encounter, items purchased, price, receiving person name.

                If the receiving person name is (Steve) in every encounter. I want the new encounter to show him automatically instead of need to enter his name again. Shall I add him as field on first database and  place that field on the encounter layout form which has all the fields from the second database or create a relationship. Thanks

                • 5. Re: Attaching different records to same client
                  philmodjunk

                  I am assuming that "Steve" is not the name stored in Name here.... I am also assuming that for a given client record a different "receiving person name" might need to be recorded.

                  If you open Manage | database | fields and double click the receiving name field to bring up field options, you can click the auto-enter tab and specify the "Value from last visited record" option for this field. That may be all you need here.

                  Alternatively, you could define a text field in Client and use the looked up value field option to auto-enter the text in this field into the "receiving person name" field. This would allow you to set up standard default values that are unique to each client.

                  • 6. Re: Attaching different records to same client
                    John_1

                     

                    The value from last visited record might belong to another client!!!

                    I ve been using duplicate record then i reenter the other details but it is confusing. I would like to be able to type the receiving person name in the first encounter  and when I return and fill the second encounter few weeks after to have it auto entered and modifiable. If (Last visited record) means the last record belonging to the same client that would be ideal, but I think it might show input from another unrelated record!!

                    In simple terms. I need to show a duplicate record showing certain previously entered fields while the rest of the fields are blank for new data entry.

                    • 7. Re: Attaching different records to same client
                      philmodjunk

                      The value from last visited record might belong to another client!!!

                      Yep, but then you can always correct this entry when such happens by enteriing the correct name in the field. It's a kind of "quick and dirty" approach that may or may not work for you here.

                      You could add a button to the portal row that duplicates that portal record, clearing fields you want cleared so that only certain fields contain the same data as the original.

                      It might use a script like this:

                      IF [ Encounters::ContactID //confirms that a record exists in this portal row]
                         Freeze Window
                         Go To Related Record [Show only related records; From table: Encounters; Using layout: "Encounters" (Encounters)]
                         Duplicate Record
                         Set Field [Encounters::Field1 ; "" ]
                         Set Field [Encounters::field2 ; "" ]
                         Go To layout [original layout ]
                      End If

                      The two set field steps illustrate how to clear any fields that you want empty in the new portal record.

                      • 8. Re: Attaching different records to same client
                        John_1

                        I think that might work. I'll try it. I really appreciate the help. Thanks