Logging PSoS Activity: Episode III – Return of the JSON

In looking back at our initial approach to logging FileMaker PSoS (Perform Script on Server) activity, I reflect back on a number of times where this has been extremely helpful. If you have come to rely on the benefits of PSoS then you also know some of its challenges — one of the biggest is debugging and monitoring how long sessions take.

Since FileMaker 16 introduced JSON, in new systems we’ve switched over to using JSON as the main way of exchanging data for parameters. Because we also use PSoS in new systems, we updated our method for PSoS Logging and this blog entry talks about the changes we made there and also restates the usefulness of this log.

So as mentioned, we update it to no longer require our custom functions for parameter passing. Those date back all the way to the six fried rice methods. After more than a decade of fine use, we finally retired them. Now in any new systems we build, we pass parameters using JSON.

It never ceases to amaze me how we can always improve our code with new ways of thinking.

There is one custom function that is at the heart of the way this works, I think it is very forward-thinking in its architecture.

Credit Steve Senft-Herrera (aka “Steve”) of Beezwax for redefining things using this approach. And Arnold Kegebein for technical review and corrections.

LogPsosParameter ( StartOrEnd )

NOTE: We store our token in a local variable scoped to the current script. This means we can set it at the start of the script, and still retrieve it at the end of the same script. The custom function builds the JSON object at the time it is called.

The first time called with Start, it builds the ID for the script. When it is called at the end it can then use that variable to locate and update the PSoS log record. The nice enhancement that Steve made in the custom function is that it doesn’t have to return the PSoS ID it is working with — the ID is in a variable that both the script and custom function have access to that save variable. One would think that defines the laws of variable scope, but no, it works and it is great. And Steve is a genius!

Here is what the PSoS script looks like in action:

Paired scripts

There is another design choice that we make when relying on PSoS and that is to have scripts work in pairs. So, we have a local script that might make sure that everything is OK to run the script on server. For example, often times we’ll do validation on the date before it gets set to the server. If everything is good then we’ll call the script via PSoS. Sometimes we’ll want to wait for the result sometimes we don’t. In either case, I find it helpful to separate them out into 2 parts.

Some developers like to have the patter of a single script being self-calling. I find that too confusing when you are trying to debug it. Just my preference!

NOTE: There are limits to how many concurrent PSoS sessions you can have. That setting can be found on the Sever Admin –> Database Server –> FileMaker Clients.

Maximum Simultaneous Script Sessions:  ###

It allows you to set this number to a very high number, but good rule of thumb is to not set it more than double the number of cores that you have.

Exploring the log

Once wired up and you want to explore the log, here is an example of what it looks like. There are 2 important columns of information: RS and RE. RS means the total number of scripts running at the start of this script, and RE means the total number of scripts running PSoS at the time this current script terminated. So, in the example below you’ll see a section primary in green. What this tells you is that you maybe have a runaway script.

What it can be helpful at telling us is how long these scripts have been running concurrently.

For this log to work it needs to have 3 custom functions, 1 table, 2 layouts ( one for the PSoS Log and one for the PSoS report ), and 1 script. Let’s look at how this works. The other thing that we recommend for PSoS logging to work reliably, would be to follow a pattern called Single Pass Loop. What this pattern allows you to do is guarantee that your script has one entry point and one exit point. This is important for PSoS logging: if you can guarantee that you only have one exit, then you can always call the terminating part for doing PSoS reliably. Including the calls for PSoS Logging, here is what the basic structure of the script would look like.

Implementing this into your solution is done with a few easy steps:

  1. Copy the 3 custom functions
  2. Copy the PSOoS table ( the default layout will be referenced by the script )
  3. Create a new layout named “Report PSoS”
  4. Copy the PSoS script folder ( it should copy over the folder and the scripts )
  5. You are ready to start integrating PSoS Logging into your solution!

Enjoy! And please let us know if you have any questions or need any help.

Demo File


Account: Admin
Password: PSoS

FileMaker & Tableau | A Match Made in Data Heaven!

It’s here and I feel like I have to tell the whole world… which is what I am doing! Now that FileMaker 16 is officially announced, there are lots of exciting things to talk about that are now possible. I think one of the most powerful new features that have been introduced in version 16 is the capability to integrate with other applications or services. There is so much to talk about what now becomes possible with FileMaker and other services/applications.

Continue reading “FileMaker & Tableau | A Match Made in Data Heaven!”

FileMaker & Tableau | Building Dashboards with Interactivity

If you’ve been working with FileMaker, then I don’t have to sell you on the fact that it’s a great solution to help you manage your data. Whether you’re an in-house developer, a consultant, or just starting to explore what is possible with this powerful platform, you will at some point come across the need to build in some kind of dashboard. Maybe your group needs to see sales trends for the last year or perhaps you have a system that tracks projects and want to see the daily average of tasks completed. In either case, dashboards are a great way to synthesize large amounts of information and provide you with insight in a simple and informative visual design.

Continue reading “FileMaker & Tableau | Building Dashboards with Interactivity”

InspectorPro 6

InspectorPro 6

Highlighting insight, performance and collaboration

Wow! InspectorPro 6 is finally here. Can’t even believe it. It was such a massive undertaking. Lots of great new things and many improvements. Really proud of this release. In the immortal words of the late Steve Jobs… “This is our best version ever”.

Continue reading “InspectorPro 6”

Export Just What You Need in FileMaker

The Lesson of Context

One of the first lessons I learned with FileMaker is that of context! Layouts, reports, calculations, scripts, and so on all act from the perspective of a single Table Occurrence (TO) — the “context” — pulling in data from related tables as needed.

Generally, the record set being acted on is the set of records in that context table occurrence or a found subset thereof. There are a few exceptions to this, however, and today we’re going to explore one of those.

Continue reading “Export Just What You Need in FileMaker”

Recycle Your Data | Save Space and Money

A few years ago, I worked on a FileMaker project where the client told us that every week they need to import about 7,000 rows of data that represent some information that this company uses. And every week there might be some modified records, some records that don’t show up any longer, and some new records that hadn’t already existed. For this example, let’s just call it this data “Products”.

Continue reading “Recycle Your Data | Save Space and Money”

FileMaker Log Files: Episode VII – PSoS Awakens

Now more than ever we’re relying on Perform Script on Server (PSoS) to maximize FileMaker performance, so naturally a need arose for a way to proactively monitor how many concurrent scripts are being triggered. This type of logging helps us see if we’re reaching our maximum limit, or have a rogue script eating up processing power.

Continue reading “FileMaker Log Files: Episode VII – PSoS Awakens”

InspectorPro 5.5 Feature List!

InspectorPro 5.5 is here! With it come some great enhancements and complete support for FileMaker 14:

• Now supports new features, themes, and styles found in FileMaker 14
• New visualization gives you a quick view of referenced and unreferenced items and problems
• New streamlined database view to help you get a bird’s-eye view of your database
• Automatic detection of malformed XML or invalid characters

A brand new Workspace!

As a FileMaker developer you probably spend a big chunk of your time writing scripts. The new Script Workspace in FileMaker 14 is going to help you in a big way. It’s a breath of fresh air and at first glance it might seem trivial in that we now have colors and we actually can have white space, but there are many other productivity improvements that lurk beneath the surface.

Continue reading “A brand new Workspace!”

1 2 3