6 Replies Latest reply on Jun 28, 2013 12:47 PM by BillisSaved

    How can you create a new record from layout tab?

    BillisSaved

      Hey all,

       

      Thanks in advance for any help or advice you offer; it's greatly appreciated!

       

      I'm creating my first database in Filemaker (FMP 12 Pro) and I'm having a little trouble figuring out how to create a new record via fields in a tab control. I can modifiy the existing data.

       

      Here's the scenario: I have a layout which displays student information (e.g., name, date of birth, etc...) and I've placed multiple tab controls on this layout which display information related to this student (e.g., employer info, training history, etc...). What I would like to do is create a tab that allows me to enroll this student in a new course (i.e. create a new training history record) that would then be displayed on the adjacent Training History tab. So far, I've only been able to see and modify the last class in which the student was enrolled. On this new tab, Course Enrollment, I don't need to see any previously attended courses, I just need to be able to create a new Training History record by selecting/entering the appropriate information for the class (e.g., course name, instructor, start date, etc...). How can I accomplish this? Thanks again for your time.

       

      God Bless,

      Bill

        • 1. Re: How can you create a new record from layout tab?
          Stephen Huston

          Use a single-row portal for a relationship which allows creation of related records via the portal, and set the portal to display only the last row.

           

          Caution: once the related record is committed, it will disappear from this tab and appear in the regular portal as a related record. This can leave users unaware that the record was created -- or just plan confused if you don't give them any visual feedback in that part of the screen.

          • 2. Re: How can you create a new record from layout tab?
            Mike_Mitchell

            Stephen's option will work fine. Another option is to use a set of global fields and a script to create the related record.

             

            In either case, to alleviate user confusion, I suggest you use a script to switch to the tab where the new record appears so the user has some feedback that his action was successful.

            • 3. Re: How can you create a new record from layout tab?
              BillisSaved

              Hey Stephen,

               

              Thanks so much for your help! I have two questions regarding your answer:

               

              1. I'm assuming the "relationship which allows creation of related records" that you spoke of is set in the relationship graph. Is that correct?
              2. You also mentioned setting portal to display only the last row. Is this accomplished via script and script trigger (which would be applied to the portal)? If so, which script trigger should I use?

               

               

              Thanks so much for your help! Have a great day.

               

              God bless,

              Bill

              • 4. Re: How can you create a new record from layout tab?
                BillisSaved

                Hey Mike,

                 

                Thanks so much for your suggestion! Global fields are still a bit of a mystery to me. That being the case, I think the portal option would be easier for me to manage. I will, however, be implementing your recommendation to provide the user with feedback to avoid confusion. Thanks again for your time.

                 

                God bless,

                Bill

                • 5. Re: How can you create a new record from layout tab?
                  Stephen Huston

                  Thanks so much for your help! I have two questions regarding your answer:

                   

                  1. I'm assuming the "relationship which allows creation of related records" that you spoke of is set in the relationship graph. Is that correct?
                  2. You also mentioned setting portal to display only the last row. Is this accomplished via script and script trigger (which would be applied to the portal)? If so, which script trigger should I use?

                  1. Yes, that is set up in the relationship graph.

                  2. In the portal setup dialogs you can control how many rows of a portal to show, and the numbers of the rows. You can also sort the portal there if you want, though it's not really neessary.

                   

                  You could also filter the portal to show only realted records which lack the foreign key from your parent record's ID -- which will force the portal to include only the creation row.

                   

                  Again, keep in mind that as soon as the use commits the new portal record, it will instantly disappear from this portal (and appear in any portal showing the regular related records).

                   

                  No script triggers involved in any of this, although you might want to consider some trigger when the user completes the last field to change their screen to show the newly-completed record.

                   

                  I sometimes have used two portals next to each other:

                  one with the single row for record creation only, and another for showing the last record created, but filtering the portal for either or both:

                  a) no blank row (don't show the creation row), and

                  b) records created Today by the current User only, for this Parent record, with the sort order so the newest is at the top.

                  That gives them a view of what they have just created.

                  • 6. Re: How can you create a new record from layout tab?
                    BillisSaved

                    Hey Stephen,

                     

                    Thanks, it worked perfectly. I really appreciate you taking the time to help me. Have a great day!

                     

                    God bless,

                    Bill