You'll need to do some scripting to get what you want.
First step is to define a new relationship for your second tab that your script can manipulate:
You probably already have a relationship like this:
Orders::OrderID = Ordered_Items::OrderID
Define a field in Orders, often it makes sense to define it as a global field, but it's not strictly necessary. Name it gCurrentItem and make it the same time as OrderID.
In Manage | Database | Relationship, click the Ordered_Items box to select it, then click the button with two green plus signs to make a new table occurrence box that also refers to Ordered_Items. If you double click this box, you can change its name to SelectedItem. Drag from Orders to SelectedItem to create this relationship:
Orders::gCurrentItem = SelectedItem::ItemID
Now we can create a script:
Set Field [Orders::gCurrentItem ; Ordered_Items::ItemID ]
You can either put a button in the row of your Ordered_Items Portal to run this script, or you can select all the fields in the portal row and use button setup to run this script. Use a separate button if you need to edit the data in the portal row.
On your details tab, place the fields about the item that you want, but select them from SelectedItem, not Ordered_Items.
As a final touch, you can use conditional formatting with this expression:
Orders::gCurrentItem = Ordered_Items::ItemID
To select a contrasting fill and/or text color for the fields in yoru portal row so that they automatically highlight to show you which ordered item has been selected.
After writing this, I realized you may need something slightly different. Most systems like this have three tables:
Where Items is a "catalog" or "price list" of items that could be ordered. My example gives you a way to show details from Ordered_Items, but with a few small changes, your detail tab could instead show data from the Items table or even information from both tables.
Hi, would this technique also work when i want to show only record in a portal based on the current selected row from another portal on that same layout?
1 Project -> X Locations per project -> X elements on that location
When 1 show 1 project with project details I show also a portal with the locations for that project in a portal and below that portal another portal with the elements located on the location that is currently selected in the location portal.
I hope this make sense...
I this case it should only show elements in the bottom portal of location_id LOC0000005 because that's the selected/current record in the first portal.
Firstly I would like to thank @PhilModJunk for sharing the detailed response and a savvy solution to a very common problem. It is people like you that keep communities turning - kudo's to you!
@ Jeroen Wolff yes this technique will work for filtering other portals based on the highlighted portal row. This is in fact the very application for which I used the above technique.
The only step missing is that of filtering the second portal based on the calculation gCurrentItem = "your PK field for the portal"
Let me know if you require more detailed information and I add to the steps to those already provided by @PhilModJunk.
Thanks again PhilModJunk and good luck Jeroen Wolff, it worked like a charm for me!