4 Replies Latest reply on Oct 3, 2011 11:13 AM by philmodjunk

    How do I Show Different Fields in a Portal based on a Type Field? (or at least make it look that...

    Brackintosh

      Title

      How do I Show Different Fields in a Portal based on a Type Field? (or at least make it look that way)

      Post

      Looking for ideas on the best way to handle this example situation:

      I have a Project record (parent) that contains a lot of information. One small portion of that info is a media portal that can show information about Music, Video or Books. Only one type of Media can appear for a project and there is a Media Type field that defines this. Some of the information about the media is common (Title, Year, etc) and other differs by type. For example, Music has an Album, and length field; Video has director and format; Book has ISBN and a Illustrated checkbox.

      From a user interface standpoint, there needs to be a single Media List tab that shows a portal listing the music, video or books that pertain to the project. The information shown in list view should be specific to the media type of the project, so you would see different columns in the portal view depending if you were looking at books, video or music. The media record will contain many more fields, so no data entry will be done directly on the portal row.

      How do I do this in FM Pro? My thoughts:

      1) Have a single related Media table that contains all of the common and type specific fields. Then show different layouts based on the media type, so the user see different information for each type. For the portal, any type specific fields that need to appear in the list mode would be calculated based on type. For example, the ListItem1 field might contain the Director for a video and the ISBN value for a book. Header values would have to be calculated as well.

      2) Have three different related tables, one for each media type. Each portal would appear in a tab on the Project layout. Then I would use the zero width portal trick (which I've never used) to hide the other two tabs based on Media Type.

      3) Have three Project layouts that switch based on the media type. (The project layout is pretty involved and I'd prefer not to have to make any changes three times, but perhaps it could be managed pretty well via the duplicate layout option.) In this case, which approach would be better - one related table with fields for all three types of media or three separate tables?

      Any thoughts on which is the preferred method or am I missing the obvious simple solution. Any help most appreciated!

        • 1. Re: How do I Show Different Fields in a Portal based on a Type Field? (or at least make it look that...
          Brackintosh

          Based on further discussions, the info stored about the media types will be much different than I originally thought, so I'm planning on having a related table for each.

          So should I use the zero-width portal trick to hide the non-used tabs (containing the other portals) or should the filtering take place at the Project layout level and have three layouts that each have a different portal included and switch based on Media type?

          I hope someone can help or at least point me to a related thread - I haven't been able to get the right search terms to find anything similar.

          Thanks in advance!

          • 2. Re: How do I Show Different Fields in a Portal based on a Type Field? (or at least make it look that...
            philmodjunk

            What do you mean by a "zero width portal"?

            I know of a method that uses an invisible tab control and wonder if that isn't what you are thinking of here...

            If so, there isn't a clear cut advantage to point to between your two options here. Both have trade offs and you'll have to decide based on exactly how you need to work with these portals and how complex your layout design will be. (the more complex, the less attractive creating and maintaining parallel layouts will be to you...)

            • 3. Re: How do I Show Different Fields in a Portal based on a Type Field? (or at least make it look that...
              Brackintosh

              Phil,

              Yes the invisible tab control is what I was thinking of. Do you have a suggestion to a thread that has a definitive "How-to" for the invisible tab control? I want to know what I'm getting in for before I make a decision.

              Thanks!

              • 4. Re: How do I Show Different Fields in a Portal based on a Type Field? (or at least make it look that...
                philmodjunk

                I suggest trying it out and seeing how it works for your specific database. Setting up a 2 or three tab invisible tab control is fairly simple, but I haven't made much use of the method so others may have better suggestions.

                Create a tab control with the needed tab panels and set them up with your portals.

                Use the name box in the inspector's position tab to give each tab panel an object name.

                What makes this work is that you use a script with go to object ["tab panel object name here"] to select the tab panel you want to bring to the front.

                You'lll need to figure out the best approach to script this. OnlayoutLoad or OnRecordLoad, for example, can run scripts that check a field on the current record to decide which go to object script step to perform to bring the corresponding tab panel to the front.

                Once you have this operating successfully, you can make the tab control invisible by selecting a zero width outline or a transparent outline pattern. The tab control's fill color can be set to match the layout's or (I think) a transparent fill color can be specified. That turns your tab control invisible.