1 2 Previous Next 27 Replies Latest reply on Feb 23, 2012 8:21 AM by blewvelvet

    Creating a Portal to It's Own Table...

    ThomasKitts

      Title

      Creating a Portal to It's Own Table...

      Post

      I'm quite new to FMP and wish to ask a simple question before I try to to frame it in a more complex way. (I'm still figuring out FMP's basics and may be attempting to do something which cannot be done.)

      Question: Is it possible to create a Table Portal, and place it on the Form View of itself?

      For example:

      I want to create an 'Addressbook' which will allow me to enter and display individual contact information in the Form View. But to the left of that information, I'd like to place an alphabetized portal which contains ALL the names I enter into the parent table (itself) -- with the idea of being able to click on a name and having the Form View jump to that contact information.

      Is this even possible? Seems basic to me, but I've been beating my head against this approach for a day now and maybe it can't be done.

      And, if doing this somehow will cause the Universe to implode in an infinite loop, well, do let me know . . . (grin)

      TIA,

      Thokitts

        • 1. Re: Creating a Portal to It's Own Table...
          philmodjunk

          What you want to do can be done, but it requires adding a new table occurrence of your AddressBook data source table.

          Tutorial: What are Table Occurrences?

          • 2. Re: Creating a Portal to It's Own Table...
            ThomasKitts

            Great. Your answer is much appreciated. I'll read the link in depth and try to absorb it.

            In general, I understand the concept of using multiple Table Instances, and relating them using a (serialized) ID and IDfk field. I even messed around with instances a bit before I posted here. However, if I create a second instance of the "Addressbook" table will I then be able to use the First and Last Names Fields' found in the second instance to populate the Portal I've place on the first instance? And here is the essential part: then have that Portal show me ALL the contact names, and not just the one name derived from the record I am currently browsing?

            (Did my question make sense? I hope I framed it clearly...)

            I'll fuss around with table instances some more right now.

            TIA

            Thokitts

            • 3. Re: Creating a Portal to It's Own Table...
              philmodjunk

              Use this relationship:

              AddressBook::AddressBookID X AllAddresses::AddressBookID

              By using X instead of = you match any record in AddressBook to all records in AllAddresses.

              In your portal, you'd add the name fields from AllAddresses to your portal and you can even specify a sort order for your portal to alphabetize them.

              • 4. Re: Creating a Portal to It's Own Table...
                ThomasKitts

                Phil:

                And that was the magic that made it happen!

                Thanks. Now I have to figure out how to turn the (new) left column of names into buttons that can take me to the appropriate contact record.

                Thanks again,

                thokitts

                • 5. Re: Creating a Portal to It's Own Table...
                  philmodjunk

                  Look up Go To Related Record. This can take you there in one step. (And you can select your name field and use Button setup... to turn it into a button.)

                  • 6. Re: Creating a Portal to It's Own Table...
                    ThomasKitts

                    I assume you mean I should use "Button Set up" to make the portal record clickable.

                    Okay, I tried assigning "Go To Related Record" to the portal field and it didn't take me to the correct record, or any record at all, actually.

                    I should add, for the purposes of making my earlier question more clear, I simplified the fields names I am actually using. The Portal list actually contain concatenations of "LastName & ", " & FirstName" from the Address Form. And each Address Form uses the same concatenated field in the upper left as well. So I hoped that simply assigning a "Go To Related Record" to the portal portal field would take me to the appropriate record, but apparently it doesn't.

                    Should the (serialized) ContactID work as a target instead? I can put that into the portal, but can I hide it?

                    Still fumbling around, but making more progress in the last 45 minutes than I did all day...

                    TIA

                    thokitts

                    • 7. Re: Creating a Portal to It's Own Table...
                      philmodjunk

                      You can't make the portal record a button, but you can make any object or group of objects in the portal row a button. This can be a group of all fields in your portal row. You don't actually have to group them, you just have to select them all before bringing up button setup... Button setup will group them for you.

                      When you use Go To Related record, there's a list of options to be specified with it. You need to refer to the portal's table occurrence name in the "from table" drop down and you need to specify a layout based on any table occurrence that refers to AddressBook as its data source table. This can be the same layout you are already on and thus you can use "current layout" instead of specifying a layout by name.

                      The other options control what kind of found set that you'll get. Don't make any other choices if all you want is to jump to the other record.

                      • 8. Re: Creating a Portal to It's Own Table...
                        ThomasKitts

                        Again Phil, excellent help. Much appreciated. Got it working on my first try.

                        So now my scrollable list of names is clickable, and jump to their corresponding record in the form view when clicked.

                        I have one more thing I need this scrollable list to do, and I think it involves some kind of conditional statement(s) entered into the "Filter Portal Records" pane, but can't figure it out.

                        ---

                        I want a pop-up menu that can filter names in the scrollable list.

                        For example:

                        1. I now have my entire list of Contacts visible, scrollable, and clickable. And each contact record has been 'tagged' with one or more categories. (The categories have been defined using a Value List and a Check-box Set. I chose the check-box function because a Contact can have more than one category assigned to it simultaneously.)

                        2. I  want to be able to select a Category (via a Pop-up Menu above my scrollable list) and have the list show only the contacts tagged with the category.

                        3. Of course, I also will also need a "Show All Contacts" option as well, to reset the entire list again. But I don't want that option to be part of the original Category Value List because it would show up as a choice when users were tagging individual records, and I think that would be confusing.

                        I've been trying get and logical functions to do this but am not succeeding. Can you help?

                        TIA,

                        Thomas

                        • 9. Re: Creating a Portal to It's Own Table...
                          philmodjunk

                          Have you considered using a checkbox format instead of a pop-up menu? That would allow you to set up an inclusive filter where you could select more than one category at a time.

                          This method will work with either approach:

                          Here's a filter expression you can adjust to work by using your actual field and table occurrence names:

                          Make your popup menu refer to a global field if you will have multiple people using your database at the same time. That way, each user can select different values in this field without interfering with each other.

                          IF ( YourTable::PopUpField = "All" ; True ; Not IsEmpty ( FilterValues ( PortalTO::CheckboxField ; YourTable::PopUpField ) )

                          You'll need one more thing:

                          Write this script: Refresh Window [Flush Cached Join Results]

                          Use the OnObjectModify script trigger on your popup menu to perform this script. The script forces the portal to refresh when you select a different value in the popup. (And if you switch to a drop down list, use OnObjectExit insted.)

                          • 10. Re: Creating a Portal to It's Own Table...
                            ThomasKitts

                            Thanks Phil, you are terrific. I will try working with the script as you have outlined it.

                            Regarding the use of a check-box set for my Contact List filter... I'd rather not for two reasons:

                            The primary reason is that I need to conserve screen space above the scrollable list, and a pop-up menu vs a checkbox set does that. There are five categories involved. (Plus a reset to Show All.) And my second reservation is that I can't think of any reason -- or, reason enough -- to permit a user to filter the scrollable list by multiple categories. I'll build that sorting capability into a report.

                            For example, in each individual Contact record:

                                 a. A contact may be tagged as a Collector, and Artist, and Gallery, and Workshop, and Other. Or not, as appropriate.

                                 b. Some Collectors are also Artists, and some Artists also take Workshops.

                            In the scrollable list, I want to be able to filter for a single category because knowing who is both a collector and an artist, or is an collector and also took a workshop, isn't helpful in this this circumstance. The scroller is meant to be used as a navigation tool for the Address Book, and not used as a reporting function.

                            I could be wrong but does my logic seem, well, logical? . . . I'm shooting for stupid simple here.

                            I will play with your scripting suggestions and get back to you.

                            TIA,

                            THomas

                            • 11. Re: Creating a Portal to It's Own Table...
                              Sorbsbuster

                              "I can't think of any reason -- or, reason enough -- to permit a user to  filter the scrollable list by multiple categories. I'll build that  sorting capability into a report"

                              Do you mean that people may find through their filter an Artist who also takes Workshops, and when they sort the final list it will show the list of Artists grouped at the top and the takers of Workshops listed below?

                              If you use the drop-down list as the filtering method then you will not have the advantage of Phil's suggestion - it will find only people listed as Artists, or Artist / Workshop, but it will not allow them to find, in one go, all the people listed as Artists and in the same list all the people listed as taking (only) Workshops.

                              If you are going to use 'Sort' to distinguish any 'dual purpose' people you may be disappointed - they will only feature once on the list, and will be listed under their first category, so you would not realise that that Artist was also a Workshop-taker by that method.

                              • 12. Re: Creating a Portal to It's Own Table...
                                ThomasKitts

                                Sorbsbuster:

                                Thanks for your response. However, my goal is to allow my user to reduce the number of total names displayed in their contact list to a single category and not to show every tag associated with each contact.

                                So if the user had, say 500 or 800 contacts in this addressbook, and couldn't remember what name they were searching for, but could remember it was an artist OR a someone who had been interested in taking a workshop, or a Gallery, they could use the pop-up menu to reduce the number of names to scan.

                                So if "John Smith" had been both tagged as an Artist AND Workshop, when I search the Contact List I can choose either Artist OR Workshop to try and find him -- to jog my memory.

                                Won't a single tag filter for, say, Workshop, find every the contacts tagged as such PLUS any contact tagged with two or more categories -- say, Artist AND Workshop, or, Artist, Workshop, Gallery? Or do I have that completely wrong? Easy enough to test once I follow Phil's directions and I'll sit down and implement his script tonight.

                                Now if there is a better way to do this I am all ears. But it seems to me if a user needs (or wants) to see every tag associated with every contact, it would be better to design a report. In List view. Yes?

                                TIA,

                                Thomas

                                • 13. Re: Creating a Portal to It's Own Table...
                                  ThomasKitts

                                  Phil:

                                  Had no problems copying the refresh window script and attaching it to the pop-up window. But I am having problems implementing your following statement:

                                  IF ( YourTable::PopUpField = "All" ; True ; Not IsEmpty ( FilterValues ( PortalTO::CheckboxField ; YourTable::PopUpField ) )

                                  When I swap out your proxie table and occurrences and field proxies to my real ones, it reads like this:

                                  IF ( CONTACTS::ContactCategoryPopUpField = "All" ; True ; Not IsEmpty ( FilterValues ( CONTACTscroller::ContactCategoryPopUpField ; CONTACTS::ContactCategoryPopUpField ) )

                                   

                                  Please note: "CONTACTS" is the actual table, and 'CONTACTSscroller" is the second occurrence.

                                  1. First, Did I do the swap out correctly? I may have mixed up the table and occurrence.

                                  2. When I placed the above script into the Portal's "Filter portal records" field I get this error:

                                    --  There are more “)” than there are “(” or there are more “(” than there are “)”.  --

                                  and I can't continue. Is the syntax incorrect? I'm using the form you gave me.

                                  TIA, 

                                  thokitts

                                  • 14. Re: Creating a Portal to It's Own Table...
                                    Sorbsbuster

                                    "IF ( CONTACTS::ContactCategoryPopUpField = "All" ; True ; Not IsEmpty (  FilterValues ( CONTACTscroller::ContactCategoryPopUpField ;  CONTACTS::ContactCategoryPopUpField ) )" - you need an extra ')' on the end.

                                    "Won't a single tag filter for, say, Workshop, find every the contacts  tagged as such PLUS any contact tagged with two or more categories --  say, Artist AND Workshop, or, Artist, Workshop, Gallery?" - as the data is entered in a check-box then it will, yes.

                                    I made the other observation about multiple categoried-contacts only appearing once on the list because you said "...permit a user to filter the scrollable list by multiple categories. I'll  build that sorting capability into a report".  If you are only interested in 'Artists' then there is nothing to sort for.  And if you are trying to sort it into the 'Artists' found and the 'Artists and Workshops' found then you may get some funny-looking sorts.  A check-box ticked 'Artist' then 'Workshop' is different from one ticked 'Workshop' and then 'Artist', for example. (I think you can safely ignore this point, at least for the meantime.)

                                    1 2 Previous Next