6 Replies Latest reply on Aug 16, 2010 12:31 AM by sunmoonstar.13

    Script or Button?

    BadSaila

      Title

      Script or Button?

      Post

      I'm wondering if FMP Pro 11 is able to perform the following using a script or button.

      Find a specific record and then open a specific layout? 

      I have tried and tried with no luck, if anyone could point this out would be awesome! Or am I just waisting my time?

        • 1. Re: Script or Button?
          sunmoonstar.13

          > Find a specific record and then open a specific layout?

          Yes, a script attached to a button could do this pretty easily. You need to provide more details, though, about your tables and fields if you want suggestions about specific script steps.

          Nick

          • 2. Re: Script or Button?
            BadSaila

            Here is how i setup my DB

            Table 1 Table 2

            Question ID Finding 

            Question 5 more fields 

            I created a one to many relationship with Question ID = 1 and Finding = Many, What I am trying to do is be able to type in a question ID and have the ID and question show up on a form with the table 2 fields being able to add records. I will be doing audits and the questions will have many findings attached to the same question over time. Hopefully i explained this with the correct amount of information.

            Thanks in advance

            • 3. Re: Script or Button?
              sunmoonstar.13

              I had to read your reply several times to understand what you were trying to explain, but I think I get it.

              Table 1 has a "Question ID" field and a text field called "Question"

              Table 2 has five fields for data entry and is related to Table 1 via the "Question ID" field.

               

              One solution is to put a portal in your Table 1 layout (www.filemaker.com/help/html/create_layout.9.24.html). Set up the portal to "Show related records" from Table 2, then add the five data entry fields to the portal.

              Open the Edit Relationship dialogue box (Manage database | Relationships tab) and make sure that it's set to "Create records..." in Table 2. Once you've done that, there will be a blank row at the bottom of your portal where you can enter data into the five fields. When you enter data in this blank row, it will automatically create a new record in Table 2 which will be related to the question ID.

              Once you've got all this set up, simply do a Find for a particular Question ID.

              Nick

               

              • 4. Re: Script or Button?
                BadSaila

                That work thanks! Is this the only way to accomplish the results? It's really not a good looking form to enter data into. 

                • 5. Re: Script or Button?
                  BadSaila

                  or have the portal go to a new record automatically?

                  • 6. Re: Script or Button?
                    sunmoonstar.13

                    > Is this the only way to accomplish the results?

                    There are other ways you could do it, but a portal is probably the easiest way to create new related records without scripting.

                     

                    > It's really not a good looking form to enter data into. 

                    Well, the portal can be re-sized and adjusted to make it look good. Try changing the size of the portal itself, change the number of rows it displays, the size of the fields, etc, and see if you can make it look better.

                     

                    > or have the portal go to a new record automatically?

                    You could write a script and attach it to a button on your Table 1 layout. The script should basically do the following:

                    * Set a local variable to the value of Question ID
                    * Go to a Table 2 layout in Form View
                    * Create a new record
                    * Set the value of the local variable to the ID field in Table 2

                     

                    But if you're not familiar with scripting, then it would be easier to simply change the way the portal looks, as mentioned above.

                    Nick