FileMaker Transactions: Processing with Magic

Jeremy Brown
May 14 · 6 min read

Start at the very beginning

We’re back at the starting context. In our case, it’s DBTransactions layout based on that same named table occurrence. Here’s what we’ve got.

  • The data was gathered and stored as a JSON object in a field.
  • There’s a relationship from DBTransactions and Order, and DBTransactions and OrderItem tables. They’re set to Allow creation of records via relationship”.
  • The relationship is created using a “orderID” and the primary key of the Order table. It’s a similar set up for OrderItem. These two fields in DBTransactions are visible on the layout (though they don’t have to be).

Here’s the thing

The key to this transaction process is that we’re doing it the same way as with portals. We are creating records through the relationship. That’s all. We do not traverse a portal to create or edit records. Instead we just set fields across the relationship. We can create the order record and all of the order line items records through their respective relationships without the need for a portal. Let’s pause a second and consider that for a moment. Is your mind blown? (Mine was the first time I saw this happening).

Oh. Another thing

Let’s talk about the relationship I’ve got set up first and establish some ideas about it.

FileMaker transactions without portals

Here are our script steps.

Step 1: Create the order record.

In this step we simply set fields in the Order table with the values from, in my case here, the JSON object.

Set Field [ Order::Date ; JSONGetElement (DBTransactions::Data ; “date”) ]

Step 2: Create first order line item record.

This first order line item record is created very much the same. We set the value of the Order Line Item::amount field with its corresponding value in the first element of the LineItems array. Notice the set up I do before actually setting the field:

Step 3: Create the 2nd and remaining Line Item records.

Here’s where FileMaker transactions without portals gets crazy, so let’s pause a moment and consider what happens next. When I grab the next line item from from the $lineItems (in my example) and I go to set the OrderItem::date field, what is going to happen?

Transact across the relationship

It’s pretty cool how FileMaker can keep all these records open and in memory when I’ve destroyed the relationship between my starting context and the records. I was blown away when I saw this happening. I swore you needed a portal to create records. But you don’t. You can do FileMaker transactions without portals.


Geist Interactive

Article and Videos from Geist Interactive

    Jeremy Brown

    Written by

    Geist Interactive

    Article and Videos from Geist Interactive