JSON Set Variable Power Tools
Our world of software development is changing rapidly! With AI influencing the way we develop, it becomes increasingly important for developers to become informed about the tools which help them become more efficient.
Fortunately, we still live in a world where people have to coordinate and organize code. Even if AI can create near-flawless code in some cases, it doesn't create the ideas. Humans are the creative force. Whether you're using a simple Find & Replace to refactor some functions, or having AI create your next powerful JavaScript for your killer Web Viewer interactions, you still need to know about your available tools.
In this video, I walk you through a recent revision to an older tool I had been using to ease the amount of typing I have to do when using JSON as the parameter passing method within FileMaker scripts or when interacting with an API or anything else that uses JSON. No joke, the content in this video and the associated technique file can save you literally hundreds of hours when used effectively. I'll show you how.
- Read more about JSON Set Variable Power Tools
- 3 comments
- Log in or register to post comments
JSON Parameter Passing
Thank goodness JSON was implemented within FileMaker. Without it, we would still be using a variety of other methods for handling multiple parameters within a FileMaker script. Using JSON, we now get the double-sided benefit of 1) having an efficient serialization of key/value pairs as inbound parameters and 2) it just happens to be the standard which most of the rest of world is using for a large chunk of how things interoperate.
In this video, and the technique file, I'll showcase a few examples of how you can receive and work with inbound parameters when using JSON as the method for handling them. We discuss script results, clean-reading code and the final example provides a very useful custom function for the auto-instantiation of JSON-based script parameters into their FileMaker scripting counterparts.
Using the provided JSONVariables custom function is a great alternative to individually parsing all of the inbound parameters. It doesn't replace the need to initially declare your variables, but it does provide the opportunity to have cleaner reading self-documenting code. If you've not used JSON for handling your parameters before, then you should start right now and use this video and file as guidance!
- Read more about JSON Parameter Passing
- 3 comments
- Log in or register to post comments
Easy JSON Record Data
Coding software solutions offers the fascinating realization that there are always multiple pathways to achieve the same goal. Sometimes the methods we're familiar with may not be the most optimal, prompting us to expand our knowledge to explore alternative approaches.
This video explores precisely that theme - the comparison between older and newer methods of accomplishing the same task. The advantage lies in the fact that newer methods often come with additional features or benefits. This is particularly true when it comes to obtaining the current record data as a JSON object. Historically, we've relied on ExecuteSQL to extract field names and values from the current record or a set of records.
In this video, I delve into the existing options using ExecuteSQL for creating a JSON object of the current record data. This method is effective in various scenarios. However, accessing related data can be time-consuming, especially when constructing SQL joins accurately requires significant mental effort. Unless you're a SQL expert, this may not be the most efficient use of your development time. Fortunately, recent versions of FileMaker have streamlined the process, making it exceptionally easy, with an alternative method, to extract any data from any record and convert it into the precise JSON object needed for passing parameters or interacting with external APIs.
- Read more about Easy JSON Record Data
- 10 comments
- Log in or register to post comments
Advanced JSON Script Parameters
While many FileMaker solutions will manage multiple parameter passing in very simple and straight-forward ways, there are some solutions which you know will grow over time. Because of this expected growth, you may want to have an additional level of comfort knowing you've implemented a very strict system for managing data transfer between scripts.
You also may be interested in working with external APIs and connecting to systems and data which is provided via the currently popular format of JSON (JavaScript Object Notation).
Since the release of FileMaker 16, we've had access to the fundamental JSON* functions. With their initial release, there were a number of developers who immediately jumped on the bandwagon. Since FileMaker 16 was released, we've had a good bit of time to codify some methods and helpful custom functions for working with JSON formatted data.
This video is all about providing comprehensive initial coverage about how JSON can be used for passing multiple parameters within FileMaker. If you never quite taken the plunge into using JSON for parameter passing then this video and the associated file may very well provide you with the incentive to take a more serious look. At the very least, you'll know what's going on when other developers mention they're using JSON parameters!
- Read more about Advanced JSON Script Parameters
- 1 comment
- Log in or register to post comments
Multiple Parameters using JSON
The ingenuity of developers has always extended beyond the limitations presented within any given environment - both physical and virtual. If you can't cross a river with your cart and horse, then you learn how to build a bridge and make it last.
Such is the case with FileMaker's script parameters. There's always been only one way to pass anything into a script - as one big blob of text. There's nothing which controls what type of data is embedded within the block of text and it's up to the developer to create a method for passing discrete pieces of data. From the most basic method of simply passing a return delimited list of data we can always take the individual pieces one by one from the list.
Things, however, can get a bit more complex with larger amounts of data. When you need to pass return delimited data as a single parameter out of many you have to be a bit more creative. This is where FileMaker's addition of its JSON functions within FileMaker 16 have helped moved the feature set forward. While there is no native methods for passing multiple parameters, we do have a standard structure for name/value pairs now when working with FileMaker.
- Read more about Multiple Parameters using JSON
- 1 comment
- Log in or register to post comments