9 Replies Latest reply on Sep 23, 2013 10:00 AM by philmodjunk

    Go to Related Record problem



      Go to Related Record problem



           It sounds stupid, but I've got a problem with Go to related record script.

           I  work on the database and keep saving previous versions of it. After a while I found that Go to Related Record doesn't do anything in the script (attached). The structure of the database has not been changed, It's still OK in the previously saved version, but just stopped working in the current one... Can't see what could influence the GTRR behavior. Tried to import script from the previous file, rewrite the script - no way.

           What could I miss?

           Kind regards,



        • 1. Re: Go to Related Record problem

               Your go to related is inside a if block, so for the Go to Related to be preformed the If statement must be true.  Your if statement is looking for an error, if there are no errors then it would return 0 and would not run. 

          • 2. Re: Go to Related Record problem

                 Hello and thanks for the answer.

                 I still can't get the result. The following script also doesn't work. It's not the IF problem I think...


            • 3. Re: Go to Related Record problem

                   The following script opens new window, said layout, but related record is not highlighted as it should...


              • 4. Re: Go to Related Record problem

                     It looks like there were and are more than one error in your script / relationship and yes the if block will not run if it is not true.

                     Your script creates a new window, hides the toolbar, goes to layout mistakes, then it going to show all related to the current record in Mistakes.

                     Go to related is going to be based on your relationship you have setup, which you haven't given any details about. 

                     1) How is the current records in List of Mistakes related to the other record in the same table.

                     2) Nothing in this script will cause the related records to be highlighted.  This would most likely be done with conditional formatting.

                • 5. Re: Go to Related Record problem

                       You don't get me.

                       The problem is that the script still works in the previous version of the file. Then the same script stopped working (Go to related doesn't go to the related record) in the current version (the structure of the database and relationships have not been changed at all, just layouts been edited).

                       The question  - what could influence the behavior of the Go to Related in any script?

                       Thank you,


                  • 6. Re: Go to Related Record problem

                         Relationship - Table occurrence. Go Related Record means record that are related by relationship. 

                    • 7. Re: Go to Related Record problem

                           And if there are no related records present for the current record at the time that the GTRR step executes, the GTRR step does nothing. Thus, your script can fail one time and work the next depending on what records are present in your tables and which record is current on your layout at the moment the GTRR step is executed.

                           This is in addition to the other problems and potential problems already pointed out.

                      • 8. Re: Go to Related Record problem

                             Just some random thoughts, I'm not sure if they will help.

                             For your first screen shot I'm wondering if the If statement should be:

                             If [ Get (LastError) = 0 ]

                             That would mean the section inside would run if there aren't any errors, but if you want to keep where it only runs when there are errors, that is fine.

                             Also, try the Go to Related Record with the "Show only related records" checked.   However, that only works with a relationship (warning indicated by PhilModJunk); in your third screen shot you are using Go to Layout before your Go to Related Record, which would never make the Go to RR work.

                             If you need something that starts at one table and needs to the same table, I would try a self join with TOs based on the same table.

                        • 9. Re: Go to Related Record problem

                               I  believe the code with Get ( LastError ) is correct. . The script attempts to open a window by name and the error code is returned if there is no such window to open. The script then uses code that includes the GTRR, to open a window of the same name if the window does not already exist.

                               But the steps to open that window and set up that window with a set of records seems odd. For one thing, GTRR can open the window, specify the layout and produce a found set of records all in one step.

                               Changing layouts FIRST, then using GTRR, changes the Tutorial: What are Table Occurrences? context and that would seem unlikely to work with most database designs.