Query current found set with Execute FileMaker Data API as JSON

Today we have a tip for you without using MBS FileMaker Plugin and in pure FileMaker. Let's say you like to query current records in your found set as JSON, how would you do this?

First you need the list of the primary keys and we like to use a While() for this. For older FileMaker versions, you could use FM.Loop instead. The loop goes over found set and just queries primary key fields for all records in found set:

While ( [ liste = ""; i = 0 ] ; i < Get(FoundCount) ; [ i = i + 1; liste = GetNthRecord ( FileMaker Ideas::PrimaryKey ; i ) & "¶" & liste ] ; liste )

We could store this in $Keys and then continue with building the request, which needs to include the layout to use and the query, which looks for all the records by ID. 

Set Variable [ $Request ; Value: JSONSetElement ( "{}"

    [ "layouts" ; "FileMaker Ideas" ; JSONString ] ;

    [ "query" ; "[{ \"PrimaryKey\":\"==" & Substitute($Keys; ¶; "\"},¶{ \"PrimaryKey\":\"==") & "\" }]" ; JSONArray ] 

)

Now we can just run this via Data API:

Execute FileMaker Data API [ Select ; Target: $$JSON ; $Request ] 

Now you can query the result from the response:

Set Variable [ $$Result ; Value: JSONFormatElements ( JSONGetElement ( $$JSON ; "response.data" ) ) ] 

And if you use MBS FileMaker Plugin, get some color to show JSON in a field:

Set Variable [ $$ResultColored ; Value: MBS("JSON.Colorize"; $$Result) ] 

Please try and let me know if you can use this in your development in FileMaker.


Xojo Tips and Tricks

We got a few tips and tricks collected for you in the last week.

1. App.Constructor

If you need code to run really first, you may go with the constructor of the Application object. This constructor runs before the Opening event, so it is your chance to do very early initialization before all other events run. But using Constructor can be tricky since you need to call the constructor on the super class and match the signature, which is not always easy to know. Let us show you how the constructors would like

Console and Desktop targets:

Sub Constructor()
System.DebugLog CurrentMethodName
End Sub

Web target:

Sub Constructor()
System.DebugLog CurrentMethodName

// Calling the overridden superclass constructor.
Super.Constructor
End Sub

iOS target:

Sub Constructor(launchOptions As ptr)
System.DebugLog CurrentMethodName

// Calling the overridden superclass constructor.
Super.Constructor launchOptions
End Sub

For some projects we use constructor to put in some logging or plugin based exception catching very early to catch issues before App.Open event runs. See NSExceptionHandlerMBS and GlobalExceptionHandlerMBS classes. (more)

Check Variables for Let

As you may know we have a variable check for FileMaker script workspace for macOS in MBS FileMaker Plugin. This works fine for most scripts, but you may need to know a few pitfalls. Since the plugin reads what is in the script workspace window and FileMaker truncates long lines, it will not catch a variable mistyped in a very long line. When we read a calculation like this one:

 

Let([

// define some variables

$varDefined = 1; $secondVarDefined = 2]; $varDefined) 

 

The plugin sees it as

 

Let([ // define some variables $varDefined = 1; $secondVarDefined = 2]; $varDefined) 

 

We don't get line breaks, so we have no idea where the comment ends and thus we can't find mistyped variable there.

 

There has been a problem that not scanning Let() for variable definitions, we now allow you to add a comment in front of the Let() or custom function call to define the variables: Start with a // comment and add they keywords @variable, @parameter or @constant (or shorter @var, @param or @const), then add a new line and continue with the calculation.

(more)

MBS Xojo Plugins, version 23.5pr6

New in this prerelease of the 23.5 plugins: Download: monkeybreadsoftware.de/xojo/download/plugin/Prerelease/ or from DropBox.
Or ask us to be added to our shared DropBox folder.

MBS FileMaker Plugin, version 13.5pr6

New in this prerelease of version 13.5 of the MBS FileMaker Plugin: Download at monkeybreadsoftware.com/filemaker/files/Prerelease/, in DropBox folder or ask for being added to the DropBox shared folder.

Six months until MBS Xojo Developer Conference

Just six months left until we start our MBS Xojo Developer Conference in Andernach, Germany. We know it is still early, but we already got a few speaker proposals and already the first dozen registrations from six different countries: 🇩🇪, 🇳🇱, 🇬🇧, 🇺🇸, 🇫🇷 and 🇨🇭.

Outside image of hotel at night.

Please join us 25th and 26th April 2024 in Andernach, Germany for a great Xojo developer conference. You may consider to arrive 24th April to join the evening reception in the hotel. Or even arrive earlier to join our Xojo training day. And if you come from far away, how about staying longer and do a bit of sight seeing with the group on Tuesday?


Moving to new JSONMBS class

If you used our older JSONMBS class and now move to 23.5 version of MBS Xojo Plugins, you may notice a few changes. The new class is better in many ways, like interface compatible to JSONItem class, adds new Query, Search and Replace methods as well as handling errors better.

We got new kType* constants for new node types. Error, True, False and Number types are gone and we got new things like Boolean, ByteString, Int64, Single, Double and UInt64. The byte string is for handling MemoryBlocks in JSON, which can encoded as Hex, Base64 or Base64URL as needed.

We now raise exceptions for all bad operations. So checking handle for 0 and checking ParseError property is gone. You can inspect the exception for it's message property to see an error message.

We preserve numbers in exact representation. If you store 1.2345 as currency into JSON with our plugin, it will stay 1.2345 and not convert internally to a double and get output as 1.2344999999999999307. Our IsNumber function handles this correctly. So if a floating point number is stored internally as string, you may see kTypeString for it, but IsNumber returns true as it's a string we use to hold a number and output it as number. We also got functions like IsInt64, IsUInt64, IsInt32 and IsUInt32 which check for IsNumber and the range. (more)

List dialog with checkboxes

As you may know, you can show a list dialog with MBS FileMaker Plugin by using our ListDialog functions. For next version 13.5 we add new functions for having checkboxes in the list.

Screenshot from macOS:

The list dialog can now operate in multiple modes:

(more)

MBS Xojo Plugins, version 23.5pr5

New in this prerelease of the 23.5 plugins:
  • Fixed isiOSAppOnMac and isLowPowerModeEnabled properties in NSProcessInfoMBS class to work in iOS target.
  • Updated DynaPDF to version 4.0.80.232.
  • Changed Orientation property in DynaPDFPageMBS class to be settable.
  • Added kctPDFA_4, kctPDFA_4e and kctPDFA_4f constants to DynaPDFMBS for CheckConformance to convert to PDF/A 4.
  • Added kpvPDFA_4, kpvPDFA_4e and kpvPDFA_4f version constants for PDF/A 4.
  • Added kcoDefault_PDFA_4 constant for default flags for PDF/A 4 conversion.
  • Tuned JSONMBS class.
Download: monkeybreadsoftware.de/xojo/download/plugin/Prerelease/ or from DropBox.
Or ask us to be added to our shared DropBox folder.

MBS FileMaker Plugin, version 13.5pr5

New in this prerelease of version 13.5 of the MBS FileMaker Plugin: Download at monkeybreadsoftware.com/filemaker/files/Prerelease/, in DropBox folder or ask for being added to the DropBox shared folder.

Using JSONPath in FileMaker

For the upcoming MBS FileMaker Plugin 13.5 release, we add three new functions:

JSONPath queries can be used in FileMaker to work with JSON data, which is increasingly common in modern application development. FileMaker allows you to work with JSON data using the JSON functions introduced in FileMaker 16 and later versions as well as with JSON functions in our plugin. JSONPath queries can be useful in the following ways:

(more)

Checking out Search function in JSONMBS with Xojo

JMESPath (pronounced "jay-mess-path") is a query language and a specification for searching and extracting data from JSON documents. It provides a way to perform complex queries and transformations on JSON data, making it easier to work with structured data within JSON objects. JMESPath is similar in concept to other query languages like SQL for databases or XPath for XML documents, but it's specifically designed for JSON.

We add JMESPath to our MBS Xojo Util Plugin for the upcoming version 23.5 with the Search()) function in JSONMBS class. You may use this function to find things and then also check Replace() to replace values you selected with an expression.

(more)

Checking out JSON.Search function in MBS FileMaker Plugin

JMESPath (pronounced "jay-mess-path") is a query language and a specification for searching and extracting data from JSON documents. It provides a way to perform complex queries and transformations on JSON data, making it easier to work with structured data within JSON objects. JMESPath is similar in concept to other query languages like SQL for databases or XPath for XML documents, but it's specifically designed for JSON.

We add JMESPath to our MBS FileMaker Plugin for the upcoming version 13.5 with the JSON.Search function. You may use this function to find things and then also check JSON.Replace to replace values you selected with an expression.

(more)

MBS Xojo Plugins, version 23.5pr4

New in this prerelease of the 23.5 plugins:
  • Changed CSIdentityMBS class to have 15 properties visible in debugger.
  • Changed localizedName property in CSIdentityAuthorityMBS class to be debugger visible.
  • Fixed an issue with JSONMBS returning single instead of double value.
  • Added ValueByteString property in JSONMBS class.
  • Added ByteStringEncoding shared property to JSONMBS class.
  • Added LineLengthLimit and NewLineCharacters shared properties to JSONMBS class.
  • Added NewByteStringNode method to JSONMBS class.
  • Added renameNode and adoptNode methods to XMLDocumentMBS class.
  • Added MongoDB Watch Changes example project to show MongoChangeStreamMBS class.
  • Added Constructor to StringHandleMBS class taking MemoryBlock.
Download: monkeybreadsoftware.de/xojo/download/plugin/Prerelease/ or from DropBox.
Or ask us to be added to our shared DropBox folder.

MBS FileMaker Plugin, version 13.5pr4

New in this prerelease of version 13.5 of the MBS FileMaker Plugin: Download at monkeybreadsoftware.com/filemaker/files/Prerelease/, in DropBox folder or ask for being added to the DropBox shared folder.

Playing with JSON Query in Xojo

Let's play a bit with our new JSONMBS class in Xojo and the query function there to run a few queries.

You may want to learn a bit about JSONPath and especially the implementation we use: JsonConsJsonPath.
Let me give you a bit of a summary about JSONPath here:

JSONPath is a query language used for extracting data from JSON documents. It is similar in concept to XPath, which is used for querying XML documents. JSONPath allows you to navigate and filter through the elements and values in a JSON structure to retrieve specific data or perform operations on it.

Here's an overview of the basic syntax and features of JSONPath:

(more)

19 years of FileMaker versions supported

Did you know the MBS FileMaker Plugin can run on all FileMaker versions from 7 to 20.2.1?

As of today the current 32-bit Windows version can load in ancient FileMaker Pro 7. We don't expect clients to use that, but from time to time, a client asks about an older FileMaker version. We highly recommend to upgrade to a more recent version.

As of today, we have about 21% of users with FileMaker 20.x, about 72% on some 19.x version and just about 6% on older versions.

For macOS we support currently macOS 10.13 and newer in FileMaker 14 and newer. If you need plugins folder older macOS versions or 32-bit FileMaker Pro, please let us know.
For Windows we support currently Windows 8 and newer. Some features require Windows 10 or newer of course. Please contact us if you need a MBS Plugin version to run on Windows 7 or Windows Server 2012 for some reason.

We also support the Claris Pro/Server line of products in case you use them.

And of course we work hard to get our plugin ready for the future. We usually test with future FileMaker versions in beta testing, so we are ready for any change long before the release.

Let us know if you have questions.

Limited access to calendars on macOS Sonoma

Your application may only have limited access to the calendar database on macOS Sonoma. The user can decide whether you get full access or just add access. See this screenshot from system preferences:

(more)

EngageU - FileMaker Conference in one month

Just one month until the EngageU conference. ClickWorks and Square Moon continue to organize a pan-european conference for Claris FileMaker developers from all over the world.

EngageU - FileMaker Conference
12th - 14th of November 2023, Antwerp, Belgium




After the conference in Malmö last year, we see the second conference coming to Belgium. This will be the largest in-person European FileMaker conference this year with about 200 participants. Claris is expected to join and all presentations will be in English.

Please don't miss this event and sign up for the conference soon: EngageU
And it's great reason for people from all around the world to do a business trip to see Belgium.

More events are listed on our events website.

MBS Xojo Plugins, version 23.5pr3

New in this prerelease of the 23.5 plugins:
  • Fixed picture output in ReSVGMBS class to not invert alpha for console projects.
  • Updated DynaPDF to version 4.0.79.231.
  • Added CreateGeospatialMeasure method to DynaPDFMBS class.
  • Updated SQLAPI to version 5.2.6.
  • Updated SQLite to version 3.42.1.
  • Updated CURL to version 8.4.0.
Download: monkeybreadsoftware.de/xojo/download/plugin/Prerelease/ or from DropBox.
Or ask us to be added to our shared DropBox folder.

MBS FileMaker Plugin, version 13.5pr3

New in this prerelease of version 13.5 of the MBS FileMaker Plugin:
  • Added Plugin.UsedFunctionCounts function.
  • Added flag to Plugin.ObjectCounts function to skip zero values.
  • Added Command-Shift-F shortcut to show find & replace interface in calculation text field.
  • Fixed find bar in data viewer for the case you got actually two of them.
  • Fixed an edge case for shifting formula text left.
  • Fixed an issue with WebHook functions and HTTP headers sent in chunks.
  • Updated DynaPDF to version 4.0.79.231.
  • Added DynaPDF.CreateGeospatialMeasure function.
  • Updated SQLAPI to version 5.2.6.
  • Updated SQLite to version 3.42.1.
  • Fixed an issue with RtlProcessFlsData crashing on Windows.
  • Updated CURL to version 8.4.0.
Download at monkeybreadsoftware.com/filemaker/files/Prerelease/, in DropBox folder or ask for being added to the DropBox shared folder.

Rome FileMaker Week 2023 - MBS Presentation

A recording of Stefanie's presentation for Rome FileMaker Week 2023 to talk about what is new in MBS Plugin for Claris FileMaker.

All movies   Watch on YouTube.   MBS-RomeFileMakerWeek-2023.mp4   MBS-RomeFileMakerWeek-2023.pdf


Time to switch to MBS Xojo SQL Plugin

Anyone using Oracle or Microsoft SQL Server out there with Xojo?

OracleDatabase and MSSQLServerDatabase class were deprecated in Xojo 2023r2 and you are recommended to use ODBCDatabase class instead.

If you need native access to Oracle, Microsoft SQL Server and other databases, your best choice is to use our MBS Xojo SQL Plugin.

We provide direct access to CubeSQL, Centura SQLBase, DB2, DuckDB, Firebird, Informix, InterBase, MariaDB, Microsoft Access, Microsoft SQL Server, MySQL, ODBC, Oracle Database Server, PostgreSQL, SQL Anywhere, SQLite, SQLCipher and Sybase. And of course we got MongoDB classes, too.

Please try it and let us know if you have questions.

How long do you wait for Insert From URL to finish?

Did you know you can run CURL commands in background with MBS FileMaker Plugin?

 

Let's start with a simple Insert From URL script like the following one. $url has the URL to query and $json the data to send to whatever web API you like to query. The headers include authentication and content types. Nothing special. The query runs and stores result in $$result and a log into $$debug. Here is the script:

 

Set Variable [ $options ; Value: "-X POST --header \"Authorization: Basic <<API KEY>>\" --header \"Content-Type: application/json\" --header \"Accept: application/json\" --trace $$debug --data @$json " ] 

Insert from URL [ Select ; With dialog: Off ; Target: $$result ; $url ; cURL options: $options ; Do not automatically encode URL ] 

 

After this is run through, you may inspect Get(LastError) as well as $$result and $$debug. And depending on how long your query runs, the FileMaker script may pause. If the server isn't answering, it may wait 90 seconds for a timeout (unless changed). Especially if you upload images over slow connections, the user may have to wait.

(more)

More Menubar options in macOS Sonoma

Your desktop app made in Xojo can take advantage of new menu features in macOS Sonoma. You can use section headers as well as color palettes. And you may use our SystemInformationMBS.isSonoma function a lot to check if your application runs on macOS Sonoma. Then you can dynamically use the new features, if you have macOS 14.0 or higher.

Let's start with the Opening event of the application or a window, where we edit the menu bar. We Query menu item (NSMenuItemMBS) representing the EditMenu and start by adding a separator item there. Then we create a section header. To avoid the objects being destroyed too early, we store the references in properties.

For the color palette, we first collect a few NSColorMBS objects in an array as well as the matching titles. Then we create a palette menu for them. To later catch the event for a selection, we connect the PaletteSelectionChange event and add the new menu as a submenu to a new menu item.

(more)

See you at Claris Engage 2024

Claris comes back with an in-person conference and well, they are a bit cautious after the pandemic. Will people return in numbers like before?

For 2024 Claris decided to keep the ball low and pick an Apple owned facility to run the conference. Sure, that saves a lot of money, which previously went to Marriott, but it separates the conference a lot from the hotel. Attendees are asked to pick a hotel in the The Domain area, a development in north Austin with a lot of shops and restaurants. It should be easy for us to meet there at various hotel bars or restaurants after the show.

The Claris Engage conference will take place one day in the Apple Campus (6900 West Parmer Lane) for training and keynote. After the keynote, we'll have a party (reception?) with food and drinks. Plenty of time to welcome old friends and talk about the keynote content. The other two days are on a different Apple Campus (5505 Parmer Lane). All the sessions will be there with lunches and refreshment breaks. Since there is no bus shuttle, be sure to organize car pools with your fellow developers.

Since the conference is going to be smaller, we attend just with one person and that is me. Not sure if we get a booth this time. As the conference is basically only 2 days plus keynote on the evening before, we expect quite a few Europeans to skip the conference this year. They would be traveling longer, then they'd be at the conference! And of course Europeans may prefer to just got to EngageU in Europe (12th - 14th of November 2023 in Antwerp, Belgium). February in Austin may not encourage attendees to stay longer and make it a little vacation.

The conference ticket is $1399 USD plus optional a $449 USD training day ticket. The early bird offer sold out the first day, so 200 people got their ticket already. If you stay at home, there is a $99 option to get just the recordings. No idea whether recordings may eventually go to Claris' channel on YouTube like the years before.

Some decisions are hard to understand. We hoped for the Nashville conference plans to be executed for 2024 (after being cancelled in 2020), but that didn't happen. I really hope for a bigger conference in 2025, maybe in California, if Apple has bigger facilities there? The yearly conference is the show case of the platform. It shows how many people are interested in the products, it brings together the developers to share knowledge, it lets Claris show off their new stuff and it creates high level content to show and publish later.

See you in Antwerp and in Austin!

MBS Xojo Plugins, version 23.5pr2

New in this prerelease of the 23.5 plugins:
  • Added new methods and properties to NSMenuMBS and NSMenuItemMBS for macOS Sonoma for palette menus and section headers.
  • Optimized Key function in JSONMBS class.
  • Fixed plugin not loading on macOS 10.13.
  • Fixed IsInt64 property in JSONMBS class to not mark number like strings as number.
  • Added Compact and CaseSensitive properties for JSONMBS class.
  • Fixed a problem with PackBitsMBS not working properly for Linux ARM 64-bit.
  • Fixed edge case for EncodingToHTMLMBS function on Linux.
Download: monkeybreadsoftware.de/xojo/download/plugin/Prerelease/ or from DropBox.
Or ask us to be added to our shared DropBox folder.

MBS FileMaker Plugin, version 13.5pr2

New in this prerelease of version 13.5 of the MBS FileMaker Plugin:
  • Added Plugin.ObjectCounts function.
  • Tuned calculation formatter.
  • Fixed plugin not loading on macOS 10.13.
  • Fixed a problem with Phidget triggers not firing for e.g. IlluminanceChange.

PS: Sorry, but version number of new plugin is till 13.5.0.01, not 2.

Download at monkeybreadsoftware.com/filemaker/files/Prerelease/, in DropBox folder or ask for being added to the DropBox shared folder.

Archives

Apr 2024
Mar 2024
Feb 2024
Jan 2024
Dec 2023
Nov 2023
Oct 2023
Sep 2023
Aug 2023
Jul 2023
Jun 2023
May 2023
Apr 2023
Mar 2023
Feb 2023
Jan 2023
Dec 2022
Nov 2022
Oct 2022
Sep 2022
Aug 2022
Jul 2022
Jun 2022
May 2022
Apr 2022
Mar 2022
Feb 2022
Jan 2022
Dec 2021
Nov 2021
Oct 2021
Sep 2021
Aug 2021
Jul 2021
Jun 2021
May 2021
Apr 2021
Mar 2021
Feb 2021
Jan 2021
Dec 2020
Nov 2020
Oct 2020
Sep 2020
Aug 2020
Jul 2020
Jun 2020
May 2020
Apr 2020
Mar 2020
Feb 2020
Jan 2020
Dec 2019
Nov 2019
Oct 2019
Sep 2019
Aug 2019
Jul 2019
Jun 2019
May 2019
Apr 2019
Mar 2019
Feb 2019
Jan 2019
Dec 2018
Nov 2018
Oct 2018
Sep 2018
Aug 2018
Jul 2018
Jun 2018
May 2018
Apr 2018
Mar 2018
Feb 2018
Jan 2018
Dec 2017
Nov 2017
Oct 2017
Sep 2017
Aug 2017
Jul 2017
Jun 2017
May 2017
Apr 2017
Mar 2017
Feb 2017
Jan 2017
Dec 2016
Nov 2016
Oct 2016
Sep 2016
Aug 2016
Jul 2016
Jun 2016
May 2016
Apr 2016
Mar 2016
Feb 2016
Jan 2016
Dec 2015
Nov 2015
Oct 2015
Sep 2015
Aug 2015
Jul 2015
Jun 2015
May 2015
Apr 2015
Mar 2015
Feb 2015
Jan 2015
Dec 2014
Nov 2014
Oct 2014
Sep 2014
Aug 2014
Jul 2014
Jun 2014
May 2014
Apr 2014
Mar 2014
Feb 2014
Jan 2014
Dec 2013
Nov 2013
Oct 2013
Sep 2013
Aug 2013
Jul 2013
Jun 2013
May 2013
Apr 2013
Mar 2013
Feb 2013
Jan 2013
Dec 2012
Nov 2012
Oct 2012
Sep 2012
Aug 2012
Jul 2012
Jun 2012
May 2012
Apr 2012
Mar 2012
Feb 2012
Jan 2012
Dec 2011
Nov 2011
Oct 2011
Sep 2011
Aug 2011
Jul 2011
Jun 2011
May 2011
Apr 2011
Mar 2011
Feb 2011
Jan 2011
Dec 2010
Nov 2010
Oct 2010
Sep 2010
Aug 2010
Jul 2010
Jun 2010
May 2010
Apr 2010
Mar 2010
Feb 2010
Jan 2010
Dec 2009
Nov 2009
Oct 2009
Sep 2009
Aug 2009
Jul 2009
Apr 2009
Mar 2009
Feb 2009
Dec 2008
Nov 2008
Oct 2008
Aug 2008
May 2008
Apr 2008
Mar 2008
Feb 2008