1 2 Previous Next 20 Replies Latest reply on Oct 2, 2009 1:52 PM by philmodjunk

    Script Help - how to create a button to navigate between tables

    sabrown

      Title

      Script Help - how to create a button to navigate between tables

      Post

      I need help creating a script to use with a button that will take me from one record in one table to a specific record in second table.

       

      I have record ID numbers in one table that are identical to record ID numbers in the second table, so I want to transition from one record in table 1 to it’s counterpart in table 2. Right now I have a button that will take the user from one table to another but I have no control over what record they see when the second table opens up.

       

      While in scriptmaker, I tried toying around with some of the available steps, like Find Record or Insert from Last Visited with no success, probably because I don’t fully understand how to apply a lot of the steps available.  Any suggestions?

       

      Thanks,

      S

        • 2. Re: Script Help - how to create a button to navigate between tables
          philmodjunk
            

          Option 1:

           

          Set Variable [$ID, table::recordIDfield]

          Go to Layout [//specify a layout here for table2]

          Enter find mode []

          Set Field [Table2::recordIDfield; $ID]

          Perform Find []

           

          Option 2:

           

          If you haven't already done so, define a relationship linking the record ID fields of the two tables.

           

          Then use:

          Go To Related Record [Show only related records; From table: "Table2"; Using layout: //Specify a layout]

           

          Caution on Go to Related Record:

           

          If there is no related record, GTRR (with a specified layout), will not switch layouts and will modify the found set. That's just fine for this example, but if you need to add script steps after the GTRR, you need to test for the absence of related records or your follow on script steps might go to work on a completely different table than you expect and that can get really messy.

          • 3. Re: Script Help - how to create a button to navigate between tables
            sabrown
              

            I played around with the No Records Present scenario with the GTRR step and that didn't seem to pose a problem.

             

            I did however encounter another issue. Table1 only has one record for each record ID. Table2 may have multiple records associated with 1 record ID. I need to be able to navigate from Table1 with 1 record ID to a found set of ALL related records from Table2. With the GTTR step it only takes me to 1 related record. (I wonder if this is what was meant by problems encountered with found sets from the other GTRR discussions that were linked here?)

             

            I had some problems with one of the options suggested: 

             

            Set Variable [$ID, table::recordIDfield]

            Go to Layout [//specify a layout here for table2]

            Enter find mode []

            Set Field [Table2::recordIDfield; $ID]

            Perform Find []

             

            When I get to the Set Field section, I can't figure out how to include the $ID portion.

            My script only shows Set Field [Table2::RecordID] 

             

            So I thought I could put together a different script that would go something like this:

             

            Copy [Select; Table1::RecordID]

            Go to Layout [Table2]

            Enter Find Mode [Pause]

            Paste [Select; Table2::RecordID]

            Perform Find

             

            With the Perform Find step there is a specify option and I have no idea how to apply a specification for what I'm trying to do.

            When I tested the script out it partially worked. The Find action was set up, BUT the user has to manually hit the enter key for the found records to pop up. Can I do something so that the set opens without requiring an extra action from the user?

             

            Thanks for all the feedback.

            -S

            • 4. Re: Script Help - how to create a button to navigate between tables
              comment_1
                

              sabrown wrote:
              I need to be able to navigate from Table1 with 1 record ID to a found set of ALL related records from Table2.

              That's not quite clear (it rarely is with abstract examples like Table1 and Table2). Anyway,  the GTRR step includes optional settings that determine the found set in the target table after going to the related record. 

              • 5. Re: Script Help - how to create a button to navigate between tables
                philmodjunk
                  

                "I played around with the No Records Present scenario with the GTRR step and that didn't seem to pose a problem."

                The specific scenario you describe here should make the use of GTRR pretty safe, when all you want to do is change to a different layout and bring up a group of records. The danger comes into play if you want your script to modify those records in some fashion after you've used GTRR to create your found set. Then you have to include a check the absence of related records to make sure those additional script steps don't go ahead and modify the wrong records.

                 

                This GTRR behavior, when there is no matching record(s), is not documented so I try to caution people about that possibility whenever the use of GTRR comes up. The link Comment posted should give you a very complete picture of how to use GTRR for your purpose.

                • 6. Re: Script Help - how to create a button to navigate between tables
                  philmodjunk
                    

                  "When I get to the Set Field section, I can't figure out how to include the $ID portion.

                  My script only shows Set Field [Table2::RecordID] "

                   

                  When you click on this script step in the script editor, you'll see two Specify... buttons in the lower right corner of the dialog. Click the lower Specify... button and type "$ID" (without the quotes) into the dialog box that pops up.

                   

                  "With the Perform Find step there is a specify option and I have no idea how to apply a specification for what I'm trying to do.

                  When I tested the script out it partially worked. The Find action was set up, BUT the user has to manually hit the enter key for the found records to pop up. Can I do something so that the set opens without requiring an extra action from the user?"

                  Note that in my script example, the brackets to the right of Enter FInd mode [] and Perform find [] are empty. You need to clear the pause check box on Enter Find Mode and you do not specify anything for Perform Find.  This is set up this way so that the find happens automatically, (using data from the variable to specify search criteria), without any need for the user to do anything.

                  • 7. Re: Script Help - how to create a button to navigate between tables
                    skn
                      

                    For the script you presented above is there a way to modify it so that you can run it on several tables at the sime time?

                     

                     

                    Thanks

                    • 8. Re: Script Help - how to create a button to navigate between tables
                      philmodjunk
                        

                      Can you give an example?

                       

                      You can only peform a find on a single table, though you can use relationships to specify criteria in other tables and can use relationships to control what additional data is accessible/visible after the find has been performed.

                       

                      You can also store criteria in a set of global fields and then perform separate finds on a series of tables, using the same fields.

                      • 9. Re: Script Help - how to create a button to navigate between tables
                        skn
                           I just repeated the script again from the Go to Layout command that seemed to work, not sure if there is another way.
                        • 10. Re: Script Help - how to create a button to navigate between tables
                          philmodjunk
                            

                          That's exactly what I meant by "You can also store criteria in a set of global fields and then perform separate finds on a series of tables, using the same fields."

                           

                          If you want a new found set in each table matching the same find criteria, that'll do it.

                          • 11. Re: Script Help - how to create a button to navigate between tables
                            skn
                              

                            I have three tables that have the field "Case ID", so I want to stay within a particular Case ID when navigatinge between the three tables (e.g 8601).  So I just repeated the script three times starting from the Go to Layout command thus changing the table name I'm referencing each time, it seems to work will this cause any problems?

                             

                            Set Variable [$ID, table::recordIDfield]

                            Go to Layout [//specify a layout here for table2]

                            Enter find mode []

                            Set Field [Table2::recordIDfield; $ID]

                            Perform Find []

                             

                            Go to Layout [//specify a layout here for table3]

                            Enter find mode []

                            Set Field [Table2::recordIDfield; $ID]

                            Perform Find []

                             

                            Go to Layout [//specify a layout here for table4]

                            Enter find mode []

                            Set Field [Table2::recordIDfield; $ID]

                            Perform Find []

                            • 13. Re: Script Help - how to create a button to navigate between tables
                              skn
                                

                              I have another question, I'm still trying to figure out this Filemaker Pro software.  Is there a way to create a field I think it would be a global field, but this field would always show the particular Case ID that I am working with.  So if I'm working with

                              Case ID= 7809, the field would show that Case ID on each table no matter which record I am working with, but would change when I move to the next current Case ID.

                              • 14. Re: Script Help - how to create a button to navigate between tables
                                philmodjunk
                                  

                                You could use a global field as long as you have a way to change the value in this field each time you choose to work with a different case number. Keep in mind that you can use this global field in relationships and portals and this might give you a cleaner way to control which group of records are visible.

                                 

                                With a global field, you can modify the find script example to read:

                                 

                                Go to Layout [//specify a layout here for table1]

                                Enter find mode []

                                Set Field [Table2::recordIDfield; Yourtable::globalfield]

                                Perform Find []

                                 

                                This works because the contents of a global field remain accessible in find mode.

                                1 2 Previous Next