3 Replies Latest reply on Dec 14, 2010 3:04 PM by philmodjunk

    Buttons within Tabbed Panel / Generating information from Portal to fields in Tabs

    MikeKeane

      Title

      Buttons within Tabbed Panel / Generating information from Portal to fields in Tabs

      Post

      I am trying FileMaker Pro 11 and I have build a database for buildings with tables for owner, tenants, agents, listing info etc. In one of my forms I constructed a layout that allows me to see all of this information in one place. I have set up a tab panel which includes owner info, listing info and tenant info. All these tabs contain fields from their related tables. Which is fine for the listing info and the owner info as there is only one record per building. However there are multiple records for the Tenants table so in order to see all the tenants in the building on the form I have created a portal to that table.

      My questions are as follows:

      1) how can I create a button / buttons that navigate thru the tenants in the tabbed panel where it only displays one tenant's information at a time? (I created buttons for "next record" but when I click them it goes to the next building and subsequently the tenant whithin that building not the next tenant in the same building.)


      2) Is it possible (and if so how can I do this) to be able to click on a tenant record within the portal area and have all the information associated with that record generate in the tenant tabbed panel?

      Thank you so much for your input.

      Picture_3.png

        • 1. Re: Buttons within Tabbed Panel / Generating information from Portal to fields in Tabs
          philmodjunk

          Questions 1 and 2 are essentially the same question. You next/previous tenant buttons can step through the portal rows and from there the implementation is the same.

          You'll need either an extra table occurrence or (if you have FileMaker 11) a filtered portal on the upper tab that filters out all but the tenant selected from the lower portal. Since you have FileMaker 11, let's use the filter approach as it's simpler to implement.

          Place a copy of your lower portal on your tab. Change it's settings so that it only displays row 1 of your portal records. Resize the portal row so that it is tall enough to contain all your detail fields shown in the above screen shot. In portal setup, define this type of filter expression:

          $$SelectedTenant = Tenants::TenantID   // use your table and field names here.

          You can place a button in the lower portal's row or (if you don't use the portal to edit data in them) you can set up the entire portal row as a button. Clicking this button would perform the following script:

          Set Variable [$$SelectedTenant ; Value: Tenants::TenantID ]
          Refresh Window [Flush Cached Join results]

          Each time you click this button, the row's tenant data will appear in the upper tab. You can even use conditional formatting to change the fill color of the fields in the lower portal to highlight to show which selected row is currently displayed in the filtered portal.

          Your next/previous tenant buttons would use a variable for tracking the current portal row and you have to given the lower portal an Object Name in the Inspector. Then your "next tenant" script would look like this:

          Set Variable [$$Row ; Value: $$Row + 1]
          Go To Object ["Tenant Portal"] // must exactly match the object name you gave it in the Inspector
          Go To Portal Row [no dialog ; $$Row ]
          Set Variable [$$SelectedTenant ; Value: Tenants::TenantID ]
          Refresh Window [Flush Cached Join results]

          And you can use a layout script trigger to initialize both global variables to row 1, TenantID of row 1 via the OnRecordLoad trigger.

          • 2. Re: Buttons within Tabbed Panel / Generating information from Portal to fields in Tabs
            MikeKeane

            Fantastic! Your contribution helped a lot. I got the selected tenant to show up in the new portal that you suggested I create in the upper tab. And I made it highlight the selected tenant within the lower portal.

            Unfortunately I must be doing something wrong or have my Database set up incorrectly because when I followed your steps to go to the next record within the portal it goes to a record (not necessarily the next one) and then stops. I can click any other record and hit the next button I created using your directions and it goes back to the same record over and over.

            I tried using your script in another layout (one for my iphone) where there is just one portal setup for Tenants (created by using the same steps you layed out for the "upper portal" in the other layout) and it didn't work either. Again it selects one tenant record and won't move from there. In this case "Tenant" in suite 100

            filemaker go layout

            Am I missing something obvious?

            Thank you again for your help I really appreciate it!

            • 3. Re: Buttons within Tabbed Panel / Generating information from Portal to fields in Tabs
              philmodjunk

              The easiest thing to miss would be to not assign an object name to the portal or to enter a slightly different name in the Go to Object step, but that shouldn't affect things when you tested it in a layout with just one portal.

              Compare what you are doing to this demo file and see if you can see what is different:  http://www.4shared.com/file/QlDZyVCV/Portal_Navigation_by_Button.html