7 Replies Latest reply on Mar 5, 2014 7:12 AM by philmodjunk

    Refreshing portals

      Title

      Refreshing portals

      Post

           Hi,

           I am using a button with refresh window (flush cached join results and external data selected too) to refresh a portal after I have changed something and I want to see the portal results change.

           This works but is it the best way to simply refresh just one set of portal results as it refreshes all the portals on the page and I don't need this, just the one portal?

           Thanks
            

        • 1. Re: Refreshing portals
          philmodjunk

               Is the portal filtered and you are modifying one of the values referenced in the portal filter expression?

          • 2. Re: Refreshing portals

                 I think the answer is no, let me explain.

                 The portal references a field called "Company Name".

                 When I change the company name, I have to go back one record or forward or do something to refresh the portal so it now shows the records related to the change in the "company name" field.

                 The code … put into the filter portal box does not change, nothing changes apart from the contents of Company Name. 

            • 3. Re: Refreshing portals
              philmodjunk

                   It sounds like the answer is "yes".

                   When you say "the portal references a field called "Company Name" ", do you mean that the portal filter expression refers to the company name field or is that a match field in the relationship for that portal?

                   What exact code do you have in the filter?

                   If you change the company name and click a blank area of the layout, outside of the portal, does that cause the portal to update?

              • 4. Re: Refreshing portals

                     Hi Phil,

                     Thanks!

                     The "company name" is something that the filter expression refers to.

                     The code in the filter is:

                     client table main table 4::ID BRANCH = client table main table:: BRANCH FIELD

                     I was looking at it last night and it does automatically refresh, it just takes time.

                     I'm starting to think that a table relationship would be better but it would need to be a relationship based on one field contains the details of another field, not equals another field.

                     Is that possible?

                     If it is, from what I've learned from you, it would cut refresh/load time down significantly.

                • 5. Re: Refreshing portals
                  philmodjunk

                       client table main table 4::ID BRANCH = client table main table:: BRANCH FIELD

                       I'm starting to think that a table relationship would be better but it would need to be a relationship based on one field contains the details of another field, not equals another field.

                       Hmm, your portal filter does not seem consistent with your description of a "contains details of a another field" type of matching logic.

                       Can you provide some examples of what you need to happen.

                       Partial text matching is one of the reasons portal filters are useful as it can be difficult to impossible to set up on the relationship level.

                       On the other hand, an ExecuteSQL calculation using the LIKE keyword might be able to do it... And we'd have to try it to see if it's any faster than a portal filter to get this to work.

                       Note: Refresh Window [Flush....] is notorious for bogging down layouts with very slow screen refreshes as it refreshes everything involved. FileMaker 13 has a new script step: Refresh Object, that might be worth a test though my own tests haven't been promising when it comes to getting a filtered portal to update. Sometimes, we can get around the need for that step for a filtered portal by including key fields as match fields in the underlying relationship by including them with the X operator. With that operator, it doesn't change what records appear in the portal, but it can force the portal to update without the need for a Refresh Window [Flush... step.

                  • 6. Re: Refreshing portals

                         Thanks Phil,

                         I've not got round to sorting this out yet, however, it's strange that such a common sense thing like a button to refresh a portal isn't there as standard.

                         The "trouble" portal actually did refresh, but it just takes time, and as there are so many other things to nail down at the moment on FM, I will resign myself to going forward one record then back to refresh, which does seem laborious but hey ho ...

                         :)

                    • 7. Re: Refreshing portals
                      philmodjunk

                           One last observation:

                           

                                The code in the filter is:

                           

                                client table main table 4::ID BRANCH = client table main table:: BRANCH FIELD

                           That really shouldn't be used as a portal filter expression--especially if you find that it's slow to update. That exact expression can be replicated at the relationship level by making ID Branch and Branch Field into match fields in the relationship. That should produce a much faster portal update.