Virtual List JSON Portal Filtering
Developing software in FileMaker can be such a joy when you're able to solve so many problems so quickly. There is, however, a point where you start to solve so many problems that your solution starts to slow down and you find yourself wondering why.
Most commonly, it's the result of cumulative features compounding to make your solution slower and slower. Without careful consideration of the user interface, and how features are presented, it's easy to create a solution which starts to lag over time.
In this video, I show how portal filters really work and how to address the issue of a portal used for a very simple selection process. In most cases, your portal is only going to show a fraction of the number of fields found in its table. To this end, you must learn how to replicate the native portal filtering feature. Filtering with JavaScript/JSON is one of the most powerful ways to present data in both an efficient and faster way.
Finding your FileMaker solution is feeling slower as time goes by? You need the content covered in this video!
Comments
Good job Matt
For me this is one of your most instructive videos. I am currently studying to modify the technique to not need to use the BaseElements plugin, when I get it I will try to publish an article on the BitWok blog
Errors
Just to let you know, the \ key is right next to the RETURN key on a UK keyboard, so I type "ma" and the RETURN key but mistakenly hit the "\" key as well, I mistakenly entered "ma\", this resulted in the portal displaying four lines of : "? * Line 1, Column 1 Syntax Error: value. Object or ..."
Filter not only from the beginning of the whole string possible?
Great job, Matt!
What I would like is to be able to use any word for filtering - not just the first one or the string all the way from the beginning.
Let's say we have "my name" as a value in a record.
I would like to be able to enter "my" OR "name" to find this record.
How could this be solved?
--
Udo Bösch
Hi Udo,
Hi Udo,
to do so you might want to change the let statement for $$VLIST within the Filter VLIST script.
Try this instead:
~function = "disp.toLowerCase().indexOf('" & ~lower & "') != -1"
Cheers,
David
Great! Thank you!
Hi David,
good suggestion! This now finds every occurrence of my search string. But also if it occurs in the middle of a word. Your suggestion gave me the idea what I can search for. And I found what I was looking for:
~function = "disp.match(/\b" & ~search & "/i)"
does exactly what I want: It finds the entries in which any word starts with my search string.
This way I don't have to convert everything to lowercase. This regex searches case insensitive.
Best
Udo
Great Video
Matt, this is exactly what I was looking to do with a legacy database. Yes, I have a table with over 1000 fields, ug. Do you have a suggestion on how to store the results of the custom function that does the ExecuteSQL via a perform script on server? I don't want to pass the results back as a parameter because of the amount of data. What is a good way to store the result on the server so the client can get access to it?
Tom Horton Lead Database Architect
www.visiongift.org
Code simplification
At around the 40:00 mark you've got an If statement at the end of the definition of the ~function variable: you don't need it. If ~lower is empty then evaluating "'" & ~lower & "'" will result in the required empty string definition ('')
--
Daniel Farnan
Ignorance is curable, not preventable
Patterncount/Position style filtering
Great technique. Would love to see it work with a pattern count or position style filter. Love the speed vs traditional filtering.
Thx for the video Matt!
I learned so much from this video.
Also many thanks to David and Udo, they saved my filering problems I encountered.
JJ
CargoCult
Amazing - the realisation even after many years of Filemaking, I am STILl implementing "things that work" just because they work, and not because I fully think about and then understand WHY they are not optimal.
I think I would prefer to use a Webviewer version of the javascript, but the whole thing is a thing of beauty.
Thanks Matt!
Great video! Question...
Matt, I won't be able to use the JSON option if I access the database from a device using FileMaker Go. Is that correct?
Data API
Hi Matt,
Nice explanation how to use a virtual list.
Why don't you use the Data API to get the data right away formated as JSON ?
Is there a way to show pictures in the portal with the virtual list?
Do you have a video to explain how to replace the portal with a Webviewer like you did it with the DataTable, but just with a simple javascript plug in or add on ?
Great Video
I love the video, I added this to our school system and went home to test it... Night and Day in terms of speed when accessing the DB from afar! Question: How can I filter down the JSON even more based on popover options (class number, student status and etc) that work along side with a filter field?