It's the database structure
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).
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.
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.
Thank you. It was a OnLayoutOpen script that I forgot of. Now works