The Support Group Blog

ChatGPT and FileMaker Coding and Integration Opportunities

ChatGPT and FileMaker Coding and Integration Opportunities

ChatGPT is dominating online and offline conversations these days. ChatGPT is a chatbot created by a company called OpenAI. But saying it is a chatbot is like saying a Porsche is a car. This particular chatbot has performance and features unlike any other chatbot or AI tool available to the public. As a result, it has generated vast amounts of press, with articles in the NY Times, Wall Street Journal, NPR, and many others. 

Why is ChatGPT a big deal?

It's like having the most intelligent friend in the world with whom you can ask natural language questions, and they will give you well-written and accurate answers, for the most part. For example, we asked it what snow was, and this was the response:

ChatGPT-FileMaker_1

You can immediately see why this is causing such a stir in academic circles. Middle school, high school, and even some college students could abuse this to get out of writing their own essays. Many already have.  

It also has a reputation for being quite good at writing software, and according to, well, itself, it is familiar with a host of programming languages, including Python, JavaScript, C++, etc. But does it know FileMaker? 

Intrigued by the tool, we dove in and asked ChatGPT FileMaker-related questions. For example, could it write a script? We asked it to do a relatively simple task in FileMaker - write a script that will print a report. Here’s what we got:

ChatGPT-FileMaker_2

When we prompted it again to do the same thing, we got a slightly different, but still overall correct, response. 

ChatGPT-FileMaker_3

The tool even comments the code, which too many human developers neglect to do. However, the comments pertain more to what the code does than why it's doing it.

Next, we prompted the tool to code something a little more advanced. We asked it to give us the low and high tide times in Boston every day in 2023. Here’s the script it wrote in response:

ChatGPT-FileMaker_4

Notice the code doesn't provide the values for all of 2023. Instead, it displays the values starting today and continuing for a year after today. Also, it uses a function called “ParseJSON,” which doesn’t exist. We tried another one: 

ChatGPT-FileMaker_5

Again, weird errors as there is no Get(TimeZoneAdjustment) function. Still, compelling stuff and, at the very least, something to guide a developer down the right path. 

We also discovered that we would get slightly different responses whenever we asked the same question. For example, this was another result for the Boston tide predictions: 

To calculate the high and low tide in Boston for each day in 2023, we need to use a script that integrates with a tide prediction API. Many different APIs can provide tide prediction data, such as the National Oceanic and Atmospheric Administration (NOAA) API or the World Weather Online API.

Here is an example of a script that uses the NOAA API to calculate the high and low tide in Boston for each day in 2023:

 # Set up a variable to store the API key

Set Variable [ $apiKey; Value: "your-api-key-here" ]

 

# Set up a loop to run for each day in 2023

Loop

  # Set up variables to store the current date and the date of the next day

  Set Variable [ $currentDate; Value: Get ( CurrentDate ) ]

  Set Variable [ $nextDate; Value: Date ( Month ( $currentDate ) ; Day ( $currentDate ) + 1 ; Year ( $currentDate ) ) ]

 

  # Set up a variable to store the API endpoint URL

  Set Variable [ $endpointURL; Value: "https://tidesandcurrents.noaa.gov/api/datagetter?" &

    "begin_date=" & Year ( $currentDate ) & "-" & Month ( $currentDate ) & "-" & Day ( $currentDate ) &

    "&end_date=" & Year ( $nextDate ) & "-" & Month ( $nextDate ) & "-" & Day ( $nextDate ) &

    "&station=8454000&product=predictions&datum=MLLW&units=english&time_zone=lst_ldt&format=json" ]

 

  # Send a request to the API and store the response in a variable

  Set Variable [ $response; Value: MBS("CURL.Execute"; $endpointURL; "GET"; ""; "Bearer " & $apiKey; "application/json") ]

 

  # Parse the response to extract the high and low tide data

  Set Variable [ $highTide; Value: JSONGetElement ( $response ; "predictions[0].v" ) ]

  Set Variable [ $lowTide; Value: JSONGetElement ( $response ; "predictions[1].v" ) ]

 

  # Add the high and low tide data to the database

  New Record/Request

  Set Field [ YourTable::Date; $currentDate ]

  Set Field [ YourTable::HighTide; $highTide ]

  Set Field [ YourTable::LowTide; $lowTide ]

 

  # Increment the date

  Set Variable [ $currentDate; Value: $nextDate ]

End Loop

This is a much more advanced response. It still needs to understand that we want the results to be for each day in 2023 instead of a year from the current day. But everything else looks like it would work.  

We tried other advanced requests. ChatGPT did a decent job of scripting a Google Calendar integration from FileMaker. In addition, it successfully wrote a script to calculate the first 100 prime numbers, though its methodology could have been more efficient.  

An interesting thing to note: the results were often different for the same request but improved with each iteration. We even told ChatGPT it was wrong, and it attempted to correct the error. We accomplished all of this using natural language with a chatbot, not unlike having a conversation with a human being. 

Our Conclusions about ChatGPT and FileMaker

So, do we expect this technology to replace human software developers? The short answer is no. By and large, the results provided a starting point for a solution to a problem. We still need to have a human who is deeply familiar with FileMaker to evaluate and implement the code. Every piece of code ChatGPT delivered had some section that would have to be adjusted for the intended solution. In addition, parts of the code needed to be corrected.  

But most importantly, most FileMaker developers are business consultants first and developers second. We excel at connecting with our clients, understanding the nuances of their business problems, and translating those requests into usable applications. ChatGPT may be able to do many things, but it can’t do that yet!

Nonetheless, this is a potentially powerful new resource for developers to use. At the very least, it can be a place to brainstorm ideas, ask questions and get responses that we can tweak to suit our needs. 

At the most basic level, we can use it as it was ostensibly intended, as a chatbot, integrated with a FileMaker solution, and set up to interact with the data in that system in a natural language way. 

We will continue exploring other fascinating ways to integrate ChatGPT with FileMaker solutions. Learn how to use ChatGPT and FileMaker.

Keep me posted

This article is also published on FileMakerProGurus.com.

Share this entry
2 replies
BrowseMode

Sign up to receive news and information about the FileMaker platform and other custom app development tools.

Keep me posted

Most Popular

Developer Resources

News, Tips & Tricks and Demos

Archives