4 Replies Latest reply on Jun 11, 2014 8:47 AM by MeatyMeats

    Show full record details for a portal row in another tab...

    LeeElvin

      Title

      Show full record details for a portal row in another tab...

      Post

      I have created a database that manages purchase orders.

      In the layout that shows an orders details it has a Tab Control with two tabs.

      The first tab contains a portal that lists all the items on the order, The information on this is the basic stock code, quantity, description, costs. This is a few of the fields from the ordered_items table.

      I want to be able to show in tab two the full record details for the item selected in tab one so that extended information can be put in such as serial number, asset location.

      From my beginners efforts the second tab only displays the information from the first item in the portal, how do I make it possible to select the other items to update them too?

      Beginner using FileMaker Pro 10 Advanced on OS X 

        • 1. Re: Show full record details for a portal row in another tab...
          philmodjunk

          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:

          Orders---<Ordered_Items>---Items

          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.

          • 2. Re: Show full record details for a portal row in another tab...
            LeeElvin

            Thank you so much for taking the time to write such a clear and complete solution to my query.

            Worked perfectly.

            Laughing

            • 3. Re: Show full record details for a portal row in another tab...

                   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.

                   Thanks.

                   jr00n 

              • 4. Re: Show full record details for a portal row in another tab...
                MeatyMeats

                     Hi There,
                     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!

                     Cheers,
                     Meaty Meats.