4 Replies Latest reply on Aug 9, 2012 2:51 PM by donjuancarlos_1

    Need help with muliple portals on same layout

    donjuancarlos_1

      Title

      Need help with muliple portals on same layout

      Post

      I have a quotes dB.  Each quote can have multiple buildings, each with its own line item.  It is set up like this:

       

      Quotes                                                  Building                               Line Items

      ID  <------------------------------------> Quote ID

      CurrentBuilding <----------------->Building#

                                                          BuildingID <-------------------->BuildingID

       

       

      I have a layout that shows the quote, a 1-row Building portal and a line items portal.

      What I want to be able to do is have the quote automatically go to Building# 1 when a user opens a quote.  Users also need to have multiple quotes open simultaneously.   I tried OnRecordLoad and OnLayoutLoad scripts to reset CurrentBuilding to 1 but the script triggers too much, not just when I load the record.  Hints?

        • 1. Re: Need help with muliple portals on same layout
          philmodjunk

          Do you have one relationship or two linking Quotes to Building?

          I can read your post as a "multi-predicate" relationship--a relationship with more than one pair of match fields, or as two different relationships, each with their own pair of match fields.

          Which do you have.

          I'd use a multiple row portal to building with just this relationship:

          Quotes::ID = Building::Quote ID

          Then I'd add a second relationship:

          Quotes::CurrentBuilding = LineItems::BuildingID AND
          Quouts::ID = Lineitems::Quote ID

          and use that for my second portal.

          A button in the portal row of the first portal or a script trigger on it can perform this script:

          Set Field [ Quotes::CurrentBuilding ; Building::Building ID ]

          That way, I can view/edit/create/delete line items for a current building record in the lineitems portal by clicking a row in the building portal. A conditional format can be used to highlight the currently selected row in the building portal to help the user keep track of which building record is currently selected.

          Note: I used a second pair of match fields in the second relationship so that you can list the same building on multiple quoates and still only see the line items for a given building specific to the current quote.

          • 2. Re: Need help with muliple portals on same layout
            donjuancarlos_1

            I have a multi-predicate relationship.  I don't have enough room for a multi-row portal to building as there are too many fields to be displayed in the building dB  (the layout is seriously packed, but I don't know how to get around it--data entry is not linear).

             

            If I do stick with a one-line portal for building, any suggestions of how to get CurrentBuilding to reset to 1 every time a user opens the quote?

             

            Thanks

            • 3. Re: Need help with muliple portals on same layout
              philmodjunk

              Which is true about your building table?

              1) You have one and only one record for each building.

              2) You have multiple records for the same building, each linked to a specfic quote record.

              Your relationship implies 2) but the rest of your layout design suggests 1).

              It doesn't look like you need a portal to Building at all here.

              You can just have a portal to LineItems and, if you want, you can set it up with a value list field and a portal with a filter expression that uses that field such that you select a building in the global field and the portal lists just lineitems for that building.

               

              • 4. Re: Need help with muliple portals on same layout
                donjuancarlos_1

                Hey, you are right, I don't need a portal to Building.  Thanks.