5 Replies Latest reply on Aug 10, 2014 7:08 AM by justjoker

    GTRR - from the record of the current table

    justjoker

      Title

      GTRR - from the record of the current table

      Post

           Hello,

           I'm trying to make a script to get a new window that would show the selected record from layout "List of trades", based on table Trades at a different layout.

           The script is simple:

           Go to related Record [Show only related records; From table "Trades"; Using layout: "Trades Lookup" (Trades);New window]

           The result I get at Trades Lookup layout is always the first record from table Trades, not the selected one. I've tried to use self-related (by ID_Trade field) table Trades 2 instead of table Trades for Trades Lookup, no help.

           What am I doing wrong?

           Kind regards,

           Sergey

            

            

      Edit_Script_Open_Trade_Lookup_from_List_of_Trades_%28New_Trading_Journal%29_10-08-2014_16-31-49.png

        • 1. Re: GTRR - from the record of the current table
          justjoker

               It's the database structure

          • 2. Re: GTRR - from the record of the current table
            philmodjunk

                 If your layout specifies "Trades" in Layout setup | Show Records from, use:

                 Go To Related Record [Show only related records; From table: Trades 2; Using layout: "Trades Lookup" (Trades) ; new window ]

                 You can specify any layout based on any occurrence of the Trades data source table (the data source table that I assume is specified for Trades 2) and you'll pull up the desired record on that layout. What is critical is that you specify Trades 2 as the "From table" parameter in this script step as that, combined with the table occurrence specified for your current layout, is what identifies the relationship is used to pull up the related record(s).
                  

            • 3. Re: GTRR - from the record of the current table
              justjoker

                   Hello Phil,

                   Thank you for the reply, but it doesn't work.

                   It still shows only the last record from table Trades 2 at layout Trades Lookup, but not the one that is selected at the layout List of Trades (based on self related table Trades)

                   I think I still don't get it. Please, help.

                   May be screenshot attached would help to understand what am I doing wrong.

                   Sergey

                    

                    

              • 4. Re: GTRR - from the record of the current table
                philmodjunk

                     If each record in Trades has a unique value in ID_Trade, what you have should work, if the script is performed from the context of the record you want to see in the new window.

                     How do you perform this script? Is there a button in the body of this layout to click to perform it?

                     From what I see in your screen shot, if you perform this script from the Manage Scripts window, I'd expect to see the last record shown appear in the new window as it is the current record on your layout. By using a button in the body of the layout to perform this script, the mouse click on the button both selects that record as the current record and then performs this script to pull it up in a new window.

                     If you are using such a button and the wrong record is still popping up, I can only suspect that some other script trigger is being tripped by this process (and here are a number of triggers that might be tripped here) and that the script thus performed by that event is keeping this script from producing the desired result by changing the current record on either the layout shown or the layout specified in your GTRR script step. And I can see in your screen shot that both layouts involved here have at least one layout based script trigger specified. If you have FileMaker Advanced, you might perform this script while the script debugger is enabled so that you can step through the script one step at a time. If a script trigger is being tripped, you'll see that script pop up in the debugger window.

                • 5. Re: GTRR - from the record of the current table
                  justjoker

                       Hello Phil,

                       Thank you. It was a OnLayoutOpen script that I forgot of. Now works

                       Kind regards,

                       Sergey