Jump to content

Bulk JSON update to Filemaker Script


Recommended Posts

  • Newbies

I need to send a JSON string containing 1000+ objects with data to be replaced into fields in a Filemaker layout.  Currently looping a NodeJS method which is taking a large Node heap allocation, and clearly the ideal way to do this is to send the data for all records in one request and loop through it within Filemaker via a script.

Closest thing I can see in the documentation is - run a script and pass a parameter that is the JSON string.  But what is the size limitation on the parameter?

Anyone actually performed a bulk operation in this manner?

Kirk

Link to post
Share on other sites

Parameters have a size limit.

Maybe you like to check JSON functions in MBS FileMaker Plugin to process them. They are made for high performance.

Especially you can check JSON.Parse to parse once and query often. And of course JSON.Import for automatic import into records, where the plugin would create table and fields and then import data.

Link to post
Share on other sites
11 hours ago, kirkroyster said:

 But what is the size limitation on the parameter?

If the script is performed server-side, then there is a limit of 1 million characters. This is documented at:
https://help.claris.com/en/pro-help/content/running-scripts-on-server.html

I could not find any documented limit for scripts performed locally. I tend to think the only limit is available memory. This is supported by some user reports.

 

 

Link to post
Share on other sites
  • Newbies

Exactly what I was looking for.  I can get the job done within 1 million characters (JSON string size in the script parameter).  Sorry that I did not find that myself.  No way I'm going to bring 3rd party plugins into the equation as I'm convinced a Filemaker script can loop through the content of a JSON string and update records accordingly.

If anyone has a good example of a script that parses JSON and loops through with record updates, fantastic.  That's what I'll be building near term.

Data API call that initiates the server side script passing a stringified JSON object array containing the values to update into the existing Filemaker records.

Kirk

 

Link to post
Share on other sites
4 minutes ago, kirkroyster said:

If anyone has a good example of a script that parses JSON and loops through with record updates, fantastic.

I think it depends on how exactly the "update" part is supposed to work. If the script needs to find each record to be updated, this could get awkward.

Filemaker has a built-in mechanism for updating records using the Import Records script step. However, JSON data cannot be imported (at least not directly). 

 

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.