Over 46,000+ Business Solution Developers Find answers, ask questions, and connect with our community of business solutions developers, business owners and partners.
Re-Run – Dynamic Portal Search with FileMaker 14 – FileMaker Today
So here is another one of those things I can’t live without, it’s really the custom function that drives this post and was created by FileMaker Inspirations but that I constantly use because of how fast it is. So lets see what it can do. I should note that you need to have FileMaker Pro 14 Advanced to be able to Import or Create custom functions which are used in this post.
The image below shows that I have only 2 tables and I have added the “_g_search” to the Contacts table so with the graph setup correctly the code could be completely modular to drop on any layout as a picker for example but thats for another post. You can also see they are connected as a Cartesian join so I can see all the records in the contacts on the SCG_Demo table.
Now I need the custom function from FileMaker Inspirations called FindWordPartsInText which can be found in their post here and also goes further into how the function works. It can also be imported from the demo file I have attached at the end.
Now that the function is imported we can add the “_g_search” field above the portal and from the image below I added Placeholder Text to let my user know what they can Search ( filter ) by.
From there I need the script that will keep refreshing the portal and keep my position on the field which I have attached below, it is set on the field as OnObjectModify Script trigger so it runs whenever typing in the field. I’m also using FileMaker 14’s script step for Refresh Portal which works pretty fast.
At this point the only thing left to do is add it to the portal. I have a screen shot showing the Portal Setup dialog which shows Sort portal records checked because I sorted by first name. Now click on Filter portal records and add in the function. By default it has 3 parameters: needles, haystack and start. Needles will be the search field added above the portal. Haystack is all the fields you want to search and they are separated by a carriage return which can be seen below in the setup I have added. And finally start which is the first word it will start on for its search which I always start at 1 but could start it further out. For more details on this function I would check out the post from FileMaker Inspirations here.
Once that is complete you are ready to start typing and it will immediately filter out. This is a basic search setup but it can be used with additional criteria setup in the portal filter but for most cases this should be simple enough. Once complete I can type different characters and separate them with a space to it will filter the fields further. From the image below it can be seen that typing “Alb mo” picked up letters from the last name as well as the street address so that makes this a great way to search.
By just removed the characters in the field it displays all the records again.
The sample data used in this file is from Brian Dunning’s website, click here to see other available sample data.
Demo File: SCG_Dynamic_Portal_Search.fmp12
Hope you enjoyed Dynamic Portal Search with FileMaker 14 and contact us with any questions at 877-501-8038. Enjoy the rest of your week!