4 Replies Latest reply on Sep 3, 2013 2:27 PM by woodeye

    Slow Portal Filtering



      Slow Portal Filtering


           Hi, I am still in the monkey phase of programing with Filemaker. See and do but not as much understanding as I would like. 

           Two tables: Companies and Contacts. Linked via Company_ID fields

           Layout with the top portal showing companies. The bottom portal shows contacts.

           I have tried two ways to have the bottom portal show only those contacts related to the highlighted company in the top portal.

           The first solution was to have a button on each row of the company portal perform a script that would 1) set a variable equal to the company_Id, 2) Refresh window (flush cached join results) and then 3) commit records. Note: the relationship between each table was via the company_id field in each table.

           The second attempt was to have (in the relationship graph) the contact table: company_ID field linked to the Company table: Global_company_ID field. On the Layout then, the button on the company portal would then simply set the global company_id equal to the company_Id of the current row.

           While both of these solutions worked, there is a 1.5 to 2.0 second delay before the contact portal is updated after clicking the button. This seems a bit long to me. Note that there are 12,000 records in the company table and 4,500 records in the contact table.

           Does anyone have any suggestions as to what I could be doing wrong?



        • 1. Re: Slow Portal Filtering

               If you have a portal to contacts and a portal to companies on the same layout, then on what table is the layout based? How is that table occurrence linked to the other two tables in a relationship?

               Are there any unstored calcaultion fields in your portal or on your layout? Your first approach isn't a good option as Refresh Window [flush cached join results] can result in a major performance hit.Any conditional format expressions? Did you use Refresh Window [ flush.... with it as well? (It's not needed for this method.)

               But the second option should work more quickly. (Though "1.5 to 2 seconds" doesn't really seem like a major delay to me....)

          • 2. Re: Slow Portal Filtering

            Relationship Graph, (TABLE:field)

            USER:user_id  ---<  COMPANIES:user_id 

            COMPANIES:global_comp_id ---<  CONTACTS:company_id

                 Layout is based on the User table. 

                 On the layout, neither portal is filtered, as I am using the relationship to acheive the link.

                 The button on the top (company) portal performs a one line script:  

                 "Set Field [ COMPANIES::global_comp_id ; COMPANIES::company_id"

                 This updates the global field with the company_id for the current row.




            • 3. Re: Slow Portal Filtering


                   I'd change that to:


                   User::global_comp_id = Contacts|SelectedComp::company_id

                   Contacts|SelectedComp is an added Tutorial: What are Table Occurrences? of Contacts.

                   That way, your portal to contacts does not need to "tunnel through" companies to link to the correct set of records.

              • 4. Re: Slow Portal Filtering

                     Thank you very very much!

                     I left the User to Company link the same (user_id), but did make the change you suggested by linking the contacts table directly with the user table via the global_comp_id to company_id.

                     Works great! no delay at all.

                     Thank you again for the help.