Portal Filtering in FileMaker 11

by Dan Stuchbury · 2 comments

Another great new feature in FileMaker 11 is the ability to filter portals without needing to create specific relationships, as was with previous versions. There are a couple of drawbacks to this – although if your requirements are fairly basic you’re unlikely to find either a major problem.

The first drawback is that the filtering is at the user-interface level only, and does not affect the actual relationship between the two table occurrences. The net effect of this is that the filter you apply to the portal won’t alter the result displayed in summary fields of summary calculations in the related table, that are outside of the portal. If, taking the Invoices starter solution as an example, you wanted to filter the invoice line items portal based on the product name (perhaps the first word of a product name, with a large number of line items this may be useful), the price calculation fields would still reflect the cost of ALL the line items, not just those that were displayed in the portal. In that particular example, that’s not a bad thing, however if you were to take a slightly different portal filtering requirement, such as a portal showing related tasks for a project with due dates and time estimates, and you had a summary calculation Sum ( Project_TASK::estimateTime ), basing your filter on the “status” field of the task, wouldn’t affect the result of that SUM calculation. See the attached file to see what I mean.

There is a workaround to this, and it’s a fairly elegant workaround – so no “hacking” required! Just create another single row filtered portal, using exactly the same filter as your main portal, and place the summary calculation field within it. The calculation will update when the filter changes.

The second drawback is the way the Goto Related Record (GTRR) script step works, specifically when it’s defined to “Show Only Related Records” – with the native portal filtering, the GTRR will show all the records that would be displayed in the portal if there filter wasn’t in place. This is because the portal filter doesn’t change the relationship between the table occurrences. Again, this is less of an issue in some applications than others.

Native portal filtering is a really useful feature for beginner and intermediate level FileMaker developers. It gives you a quick and easy way to filter your portals (and of course you can make the filter based on whatever criteria you like), that doesn’t require you to create additional relationships.

{ 2 comments… read them below or add one }

Aunt Julie August 9, 2011 at 22:13

Hi Dan –

I am pretty new at Filemaker. I have Filemaker Pro Advanced 11. I wonder if you can help me.

I’ve successfully used the work-around of a second portal with the same filter to show summary results. What I need now is to preserve that filtered summary calculation so that I can use it in the future.

For example, I have an invoicing system that uses a portal on an invoice to show any unpaid past invoices, and a portal to show current charges. When I create a new invoice, or when I enter a payment, I want the overdue total on the old invoice to stay the same. I think I need a lookup value to preserve the portal summary, but when I summarize outside of the context of the portal, it of courses is not filtered!

Any ideas?
Thanks in advance,
Julie

Reply

Dan Stuchbury August 10, 2011 at 19:40

Hi Julie,

Take a look at the file at http://dl.dropbox.com/u/609980/Invoice%20Payments%20Example.fp7

I’ve added a “Paid” flag to the invoice table, and used that field in the portal filter.

I hope you find this useful, and that I’ve interpreted your question correctly. Please let me know how you get on, and of course, I’d be happy to answer any other questions you have.

Regards,
Dan

Reply

Leave a Comment

Spam Protection by WP-SpamFree

Previous post: