14 Replies Latest reply on Sep 3, 2012 2:59 PM by RedzwanLatif

    Portal inside portal

    RedzwanLatif

      Title

      Portal inside portal

      Post

      Hi. I've followed the steps from this post. http://forums.filemaker.com/posts/b799cbbd79

      Let's assume you have these three tables and relationships:

      Master, Child, ChildDetail.

      Master::MasterID = Child::MasterID
      Child::ChildID = ChildDetail::ChildID

      On a Master based layout, add portals to Child and ChildDetail. Define this Portal Filter for ChildDetail:

      $$ChildID = ChildDetail::ChildID

      Write this script:

      Set variable [$$ChildID ; Value: Child::ChildID ]
      Refresh Window [Flush cached join results]

      Attach this script to either a button located in the Child Portal row or you can select all the portal row fields and use Button setup to turn the entire row into a button that performs the above script. (The second option allows you to just click a portal row to select the detail records in ChildDetail, but you can no longer edit the fields by clicking into them so use the option that works best for your layout needs here.)

      Now one last detail. You can set a conditional format on all the fields inthe Child portal row with an expression like this:

      $$ChildID = Child::childID

      And specify a a light pastel fill color to "highlight" the currently selected portal row in the Child Portal to make it easier to see to which Child records, the currently visible ChildDetail records belong. (You can also specify a bold text style and/or a different text color.)

       

      I've set the script trigger OnObjectEnter. But after I choose the portal row, whenever I enter the data in the ChildDetail portal, it would enter the data for portal row one. Are there any solutions or alternative ways for this?

       

      Thank you :)

        • 1. Re: Portal inside portal
          schamblee

          I don't understand what you are trying to do.  Your questtion does not follow the title. 

          It easy to create a highlight bar to highlight a entire row in a portal. 

          1.  Create a field in your database and call it HighLightBar

          2.  Lay this HighLightBar Field on top of all of your other fields in the portal.

          3. From the inspector click the Apperance Tab

          4. Click the 4th button to right under custom styles to remove all styles from this field.

          5. Change the drop downlist from normal to hover.

          6. Set the Highligh fill color to the desired color and at the bottom of the color bar you will see opacity.  change opacity to about 50%.  this will make the fields behind the bar to be visible.

          7.  Program this button on this field. (Instead of each field in the portal).  When your mouse hovers over an item in the portal it will highlight the whole bar and when you click the bar it will peform your script.

           

          Once you select a portal row you can have a window popup to display data from another table.

          Attached is a sample highlight bar portal.

          https://www.sugarsync.com/pf/D9559058_790_706967167

          This is a sample I created for another person.  Click the parent tab and then click to add / link parent to view the portal.

          (Or just go to the parent layout)

           

           

          • 2. Re: Portal inside portal
            RedzwanLatif

            For a detail problem description, There are Billing(Left) and Deposits(Right) portal. What I'm trying to do is when I click a portal row in Billing portal, the Deposits portal will show the related records for the primary record in Billing portal. When I click another Billing portal row, the Deposits portal will show the related records for the current clicked primary record in Billing Portal Row. I've followed the steps above ( in my last posts ) to do it. But, the problem is I've set the script trigger that will run OnObjectEnter. But after I choose the Billing portal row ( Primary Record ), whenever I enter the data in the Deposits portal, it would enter the data for Billing portal row one (First Primary Record)

            • 3. Re: Portal inside portal
              schamblee

              You don't need a script trigger here.  If you got your relationship correct, then all you have to do is setup the field as a button or use the highlight bar example,  then go to related records.  My sample app does this same thing.  If you click on the parents name in the portal it show that full detail on the left.  Take a look at the sample app, again.  You can left click the highlight bar and goto button setup. (In the sample app).  You don't have to use the highlight bar, but you would still use button setup on the fields in the portal.  You need to go the the "Parents" layout in the sample.  This sample was already done, so I just used it again.

              • 4. Re: Portal inside portal
                GuyStevens

                There is a way to create two portals and have the ability to select one record in the first portal and have related records show up in the other portal.

                I don't have time now but if this interests you I could explain it a little further in a few days.

                • 5. Re: Portal inside portal
                  schamblee

                  Here is another sample app using one portal to select items in second portal. 

                  https://www.sugarsync.com/pf/D9559058_790_707898723

                  • 6. Re: Portal inside portal
                    RedzwanLatif

                    S Chamblee, thanks for answering :D, I've tried the second sample, it seems that the portal is from a same table. For this one, I've three different tables linked this relationship :

                    Clinical::__pkclinicalid = Billing::_fkclinicalid

                    Billing::__pkbillingid = Deposits::_fkbillingid

                    The first sample seems to just show the records. In this case, The two portals are from different tables. The use should have capability to add new related record in the Billing portal.

                    What I am trying to do is as DaSaint posted:

                    There is a way to create two portals and have the ability to select one record in the first portal and have related records show up in the other portal.

                    :D

                     

                    DaSaint, thanks for answering also :), yes that's what I'm trying to do. I respect your time :)

                     

                    • 7. Re: Portal inside portal
                      schamblee

                      The second sample is as DaSaint posted.  I will work on another sample using information from your screen shoot.  I modified a sample I already had so I could post faster.  I will try to post the new sample later today.

                      • 8. Re: Portal inside portal
                        schamblee

                        This sample is created using data similar to your screen shot.  I'm sure there are some difference, but you would use the same concept to create the portals you need.  Basically when you click the left portal it sets a holding field that you base a new relationship on.  The field under the first portal. 

                         

                        https://www.sugarsync.com/pf/D9559058_790_707142964

                        • 9. Re: Portal inside portal
                          GuyStevens

                          Nice example S Chamblee,

                          But it looks like I can't edit anything in the first portal.

                          And that's kind of a deal breaker. :(

                          • 10. Re: Portal inside portal
                            schamblee

                            Remove the highlight bar,  then setup the field button on the first field that doesn't need eidt to run the script Update ViewKey,

                            or Remove the highlight bar and add a button to portal to run the Update ViewKey.

                            • 11. Re: Portal inside portal
                              RedzwanLatif

                              S Chamblee, thank you very much :D. But it seems to cannot add new records in the first portal. Is there any way to allow it to create new records?

                              • 12. Re: Portal inside portal
                                GuyStevens

                                I had been thinking about making a little screencast showing this technique, and now someone else was also asking about this technique. So I quickly made a screencast:

                                http://www.youtube.com/watch?v=VJqA03X33DQ

                                If you want to see everything clearly then set the video to play at a higher resolution using the controls on the bottom of the video window.

                                And there is a little demo file here:

                                https://dl.dropbox.com/u/18099008/Demo_Files_FMP12/TwoPortals_Billing_Deposits.fmp12

                                1 of 1 people found this helpful
                                • 13. Re: Portal inside portal
                                  RedzwanLatif

                                  DaSaint, thank you very much :D, really appreciate your help :). It has solved my problems :D

                                  • 14. Re: Portal inside portal
                                    RedzwanLatif

                                    S Chamblee, thanks for answering too :D. Maybe your solution may help me with the other parts of the db. :D