by Brian Ouimette
FileMaker "Portal In A Portal"
I have to say we have a fantastic platform to be developing such amazing custom apps in. There are so many amazing features and things we can do to enhance the solutions we provide our clients. However, during the course of development and your career you get accustom to the limitations of the environments you work in.
In this blog, I will demonstrate the solution I came up with to accomplish the "portal within a portal" functionality. This was a major requirement to the project, and as most FileMaker developers know, we cannot actually create a portal within a portal. However, what you are about to see will accomplish the look and feel of the aforementioned, leveraging some of FileMaker's other functionality.
When finally getting back to the portal in a portal issue, I thought back to a solution I came up with for displaying JSON from a global variable, which used rows of button bars to display records contained in a JSON Array. I decided to use the same approach, adding buttons to provide the look of a scroll bar, and to accomplish the functionality to give the feel of scrolling. What I came up with was using counter field and the JSON parsing to move the index each row was looking at. So, when you clicked the down arrow it would increase the index of the JSON each row looked at by one, and conversely if you click the up arrow it would decrease the index each row was looking at by one.
Once this method was set up, it worked well, but it was not an easy implementation, especially when trying to format how the data would be displayed. If changes were to be needed, you would have to change each button individually, making this an absolute nightmare to manage. While reviewing this solution with a colleague, they suggested repeating fields and using the Get(CalculatedRepititionNumber) function. This allowed for a much simpler implementation, and allowed you to size and format each column quickly and easily with no crazy calculations or overhead to handle displaying the data properly.
In the following demo file, I have setup a customer layout with an invoice portal. I can’t tell you how many times I have heard, "it would be nice to see what was on the invoice within the same portal." With this example, this is finally something that is achievable.
There is an internal “portal” that has a set of buttons to allow scrolling one record up or down, and another set of buttons that will allow you to page up or down on the internal portal. I have also setup a way for allowing editing of these records in a clean and easy way. In addition to those features, I have worked to keep this modular and as light weight as possible from a performance perspective. The JSON is built using a recursive custom function and the script can be run server side (PSOS).
This demo is still a work in progress but I felt that it is close enough to bring to the community to show that with the use of native FileMaker tools, including the JSON features released in 16, we can provide a more robust solution to our clients. There is also a copy of this post on the iSolutions website. Feel free to leave feedback and suggestions.