JSON, Level: Intermediate

A JSON Miscellany, part 1

In this 2-part series, we’re going to take a look at various JSON-related topics, including a bug fix in FM 19, two free web services that return useful information in JSON format, and several ways to parse a found set into a JSON object.

Fixed in 19: JSON validation bug

In FM 18 (but not in 16 or 17) JSONFormatElements and other JSON functions can mask mangled JSON errors, making them harder to detect and correct. I wrote about this in detail last year, but, briefly, a JSON bug that was introduced in FM 18 has been corrected in FM 19.

Steps to replicate:

Create some JSON, and then transform it, but intentionally botch the transformation, for example, attempt to update an array using object notation:

2020-07-05_125525 Continue reading “A JSON Miscellany, part 1”

Level: Any, Version: FM 16 or later

FilterValues, part 2

Sometimes it happens that the real value of a blog posting emerges in the comments section. Such was the case last time, when Paul Jansen posted an elegant little workaround to remedy a performance issue with the FilterValues function. Paul’s workaround is deserving of its own demo, and that’s what we’re going to look at today.

Demo file: filtering-values-v2.zip


Continue reading “FilterValues, part 2”

JSON, Level: Advanced, Version: FM 16 or later

Ordering Elements within JSON Objects


If you’ve generated JSON objects via FileMaker, you’re likely aware of the disparity between the order in which you specify the elements, and the order in which they subsequently appear (i.e., alphabetized by key name). As I wrote two years ago (in Thinking About JSON, Part 2)…

Both JSONSetElement and JSONFormatElements will automatically alphabetize key/value pairs within JSON objects. This can be disconcerting if you aren’t expecting it, but eventually you work through the stages of grief and come to accept that it’s just the way things are. The JSON Data Interchange Standard definition at json.org specifies that “An object is an unordered [emphasis mine] set of name/value pairs”, whereas an array is an “ordered collection of values”. In other words, by definition the order of the key/value pairs within JSON objects simply does not, and should not, matter.

Well… okay… you know that, and I know that, and FileMaker knows that, as do the JSON Jedi… but what if you are demonstrating a proof of concept to a client, and to avoid cognitive dissonance and unnecessary explanation you’d like to “doctor the evidence” (so to speak) and order the elements meaningfully?

For example, you’d like them to see this…

2020-04-29_165223 Continue reading “Ordering Elements within JSON Objects”

ExecuteSQL, Level: Intermediate, SQL, Version: FM 10 or later

GetFieldName Revisited

Long time readers of this blog will be familiar with the following scenario —

An ExecuteSQL expression is given, e.g.,

ExecuteSQL ( "
   SELECT SUM ( net_amount )  
   FROM cc_transactions 
   WHERE batch_date = ? 
      AND batch_region = ? 
      AND card_type = ? 
" ; "" ; "" ; $theDate ; $theRegion ; $theCard )

…followed by a disclaimer along the lines of

For readability, static code has been used… in the real world I would employ robust coding practices to prevent accidental breakage due to field and/or TO renaming.

…with the link pointing to custom functions utilizing a combination of GetFieldName and Quote to ensure that using reserved words or potentially-problematical characters (such as a space or #) in table occurrence or field names, or renaming either of the preceding, will not break your SQL code. Continue reading “GetFieldName Revisited”

JSON, Level: Advanced, Version: FM 18 or later, Virtual List

Virtual Portal, part 2

[Note: several hours after posting this article I realized the “Hide Object” calc could be streamlined. Screen shot and demo have been updated to reflect this.]

Demo file: virtual-portal-v2b.zip (requires FM 18 or later)

This is a quick follow up to the Virtual Portal article I posted the other day. As you may recall, the objective was to use virtual list to display disparate entities in a portal…


…via an array like this…

2020-02-16_18-29-04 Continue reading “Virtual Portal, part 2”

ExecuteSQL, JSON, Level: Advanced, Version: FM 16 or later, Virtual List

Virtual Portal

Demo file: virtual-portal-v1b.zip

This is a follow-up to last month’s article on virtual list, and this time we’re going to explore a way to use virtual list in a portal.

Imagine you have built a system where a Company can be a parent of a Mill, Refinery, Estate, or another Company.


Each of these entities exists as a separate table in your database…


…and from the perspective of a Company record, you’d like to be able to see all immediate children. Continue reading “Virtual Portal”

Level: Advanced, Version: FM 16 or later, Virtual List

Virtual List Simplified

Demo file: virtual-list-simplified.zip

Note 1: The example in today’s article/demo is intentionally very basic.
Note 2: The demo is self-populating to keep the data current, so the values you see in the screen shots will not exactly match those you encounter in the demo.

Recently I had the pleasure of discussing virtual list with Paul Jansen and Jeremy Brown on The Context podcast. One consequence of having written so much on the subject over a period of many years, is that information has been spread across many articles. Another consequence is that my thinking re: certain implementation specifics has changed over time.

At the risk of stating the obvious, there are many, many ways to skin the virtual list cat, and the purpose of today’s article is not to say “this is the best way”, or imply that other approaches are flawed, but simply to propose one particular approach you might take — especially if you are either: a) new to virtual list, or b) already using virtual list, but aren’t completely happy with your current implementation.

At any rate, my aim today is to gather some useful insights from earlier articles into a single document (with an occasional new idea thrown in as well), and some of what follows has been recycled from those earlier articles. Continue reading “Virtual List Simplified”

Level: Any

Table Of Contents for FileMaker Hacks

As 2019 draws to a close, I am mildly astonished to note that FileMaker Hacks is now nine years old. As promised in my recent conversation with Jeremy Brown, and in response to a number of  reader requests, here, for the first time, is a comprehensive table of contents.

While some of these articles have become obsolete, a surprising number of the older ones are still relevant today… a tribute to the continuity of FileMaker and how knowledge gained in one version can remain useful indefinitely.

Another aspect driven home for me during the compilation of this T.O.C. (which entailed revisiting 200+ articles — some of which I’d completely forgotten about) is what a profoundly collaborative effort this blog has been, not only thanks to the illustrious list of guest authors, but also due to the sheer volume of articles that, while written by me, would not have existed without the input, examples and inspiration provided by so many others in our community.

28 Dec 2019: Table of Contents has been moved to its own page, and will be updated as new articles appear.

ExecuteSQL, Level: Intermediate, SQL, Version: FM 16 or later, Virtual List

2-Column Magic Value Lists, part 2

Disclaimer: the techniques shown in this article are provided on an as-is basis. Use with appropriate caution and at your own risk.


This is a quick follow-up to last month’s article on 2-Column Magic Value Lists, and, to avoid repetition, will assume the reader is familiar with that material. A colleague pointed out that it might be helpful to offer some real-world applications of this somewhat esoteric technique, and today we have two demos based on last month’s demo #2, but this time actually doing something useful.


Demo Files

Continue reading “2-Column Magic Value Lists, part 2”