The Original FileMaker Community
Business Templates - Demo Apps - Video Tutorials -Samples - Help - 46000 Member Forum

The Leading Filemaker Developer Tools

bBox for FileMaker v0.96 Now Available – beezwax blog

We are pleased to release bBox version 0.96. bBox is a free utility plug-in to extend FileMaker solutions to easily use code libraries and macOS-based functions from Python, JavaScript, PHP, Ruby, AppleScript, Bash/sh, XPath, and SQLite. Also included is a demo file that has over 210 examples of how you can put bBox functions to work for you.

System requirements for bBox v0.96 are:

  • macOS 10.13 or higher*
  • FileMaker 19, 18 (or 17**)
    • Works with FileMaker Pro 19.1, 19, 18
    • Works with FileMaker Server 18, 19
*  Tested for basic compatibility with macOS 11 Big Sur Preview/beta. We will update this blog post if there are any issues with bBox 0.96 and macOS 11 Big Sur final release.

** Tested for installation compatibility with FileMaker 17, although we recommend upgrading to a newer FileMaker version (> FM 17) still supported by Claris.

New Features

bBox_JQ: This is a new function with access to most of the features of the jq command. Although there’s some overlap with existing FileMaker JSON functions, jq gives better handling for iterating or transforming JSON data. It should also give better performance when working with larger chunks of data than the native functions.

Let’s try some simple examples. If we have the the following in a variable named $json defined to contain:

[{"name":"apple","price":8}, {"name":"orange","price":10}, {"name":"peach","price":30}, {"name":"banana","price":7}]

We can easily extract every name using its iteration operator, using the -r option to give raw results:

bBox_JQ ( 0; $json; "-r"; ".[].name" )
apple
orange
peach
banana

For a slightly more complex example, we’ll first select any records with a certain price, and then extract the names from result:

bBox_JQ ( 0; $json; "-r"; "map(select(.price > 9)) | .[].name" )
orange
peach

Finally, let’s try remapping the fields:

bBox_JQ ( 0; $json; "-c"; "[.[] | {"fruit": .name, "weight": .price}]"
[{"fruit":"apple","weight":8},{"fruit":"orange","weight":10},{"fruit":"peach","weight":30},{"fruit":"banana","weight":7}]

There’s quite a bit of online content about jq, but definitely check out the jq tutorial and documentation pages.

Currently bBox is employing version 1.6 of jq.

bBox Python3 Run: This is a new script step (not a function) that uses Python 3.x to compile & run the given Python script.

Unlike the Python 2.7 based functions that bBox already has, the execution is “atomic”, since it runs in its own forked process, and allows for multiple Python instances to be running at the same time. However, once the Python script is done and the result (if any) is returned, all context & data is gone. As with several other bBox functions, you can also add the asynchronous (+4) flag to the mode parameter. This will allow FileMaker to continue running without waiting for the Python script to complete.

There is a bit of trickiness about which copy of Python3 is used, especially if running on macOS versions prior to Catalina. Unlike Python 2.7, Python 3 is not installed by default. However, if you are using a Catalina or Big Sur, installation of Apple’s version of Python 3 is usually easy — just log in to the desktop, open a Terminal window, and execute python3. A dialog will then pop up on  your desktop to install Apple’s Command Line Developer Tools with a single click to start its installer. Once that’s done you’ll have a copy of Python 3.7 or better.

If this was a system where the OS was upgraded it may sometimes take some extra fiddling to get the command line tools installed. Often running this will resolve the installer issue:

xcode-select --install

With that hopefully done, the python3 command will be installed at:

/usr/bin/python3

Which is also the default path used by the bBox Python3 Run script step.

But what if you are using a macOS version prior to Catalina? Or, you want bBox’s script step to use a different version of Python than what Apple installs? For these scenarios, add the “Use Alternate” (+16) option to the mode parameter, and bBox will attempt to use the Python version at this path instead:

/usr/local/bin/python3

The above location is also the path that the Python Software Foundation’s official Python 3 installer will use. You can get the macOS installers here: https://www.python.org/downloads/mac-osx/

Bash/Shell/Zsh Error Messages: If your script generated a shell error, the bBox_LastError function would give you a generic version with the POSIX error code number, and it was up to you to determine the meaning of the codes. Version 0.96 will now gives an explanatory message for most errors. Unfortunately, this will not cover any error codes returned by commands your shell scripts run — you’ll have to refer to to documentation or source code of the command to determine the meaning of its result codes.

bBox_Ruby: Similar to the new Python3 script step, the bBox_Ruby function now supports the “Use Alternate” (+16) mode flag. If set, it will attempt to use the Ruby interpreter installed here:

/usr/local/bin/ruby

Bug Fixes

bBox_Curl: bBox_LastError will now only return the error result for the last call to the function, instead of the last non-zero result.


Download bBox plugin
bBox product page
Apple XCode Downloads and Resources

– Simon

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

Privacy & Cookies Policy