NFC Scanning with FileMaker Go

FileMaker Go 19 can read data from an NFC tag, which is one of the features under the “Smart AI. Smart Apps” umbrella, together with Siri Shortcuts and the use of Machine Learning models.

What is NFC?

Near-Field Communication allows for wirelessly sending small amounts of data over very short distances. Most of us use it often these days in the form of Tap-to-pay and other forms of contactless payments like Apple Pay with an Apple Watch. It is also frequently used for various keycards, perhaps to get access to the building where you work.

At its core, NFC is fascinating technology where your hardware (say your phone) supplies the power to activate a radio frequency field on an NFC tag, whose tiny radio antennas then transfer small quantities of data to your device. For this to work, your device has to be very close to the NFC tag, a distance of fewer than two inches.

NFC Power Source

The NFC tag itself is completely passive; it does not have a power source of its own. Radio waves from your device supply the power to activate it. This is one of the bigger differences with similar close-proximity communication technologies such as Bluetooth, where the ‘tag’ has its own power (usually a battery). Because of this, Bluetooth has a bigger broadcast range.

Screenshot that shows various types of NFC tags
Figure 1. Various types of NFC tags

The NFC tag holds data but not a lot of it. The data can be written to the tag in a few different formats, as specified by the “NFC Data Exchange Format” (NDEF).

It is important to note that FileMaker Go can only read a subset of all these different formats; it supports these types of content:

  • plain text
  • URL
  • XV card — which is a “Media” format of type “text/x-vCard”
  • “Smart Poster,” which is a commonly used combination of text and URL

If the NFC tag holds data in another NDEF format, then it cannot read it.

NFC on iOS

Equally important is that not all iOS devices have the hardware capability to read NFC tags, even if they can use NFC for Apple Pay. iPads, for instance, do not have this capability, nor do some of the iPhones. The information about device compatibility is fairly muddled, but this source has a good overview.

How to Read an NFC Tag

To read an NFC tag, you invoke the new script step, Configure NFC Reading. The script step has two actions: Read and Cancel. The other configurations include the script you want to run when the scan is finished (or times out), a timeout period (the default is 45 seconds), and an option to scan continuously (well suited for scanning multiple tags in quick succession).

Screenshot of the Configure NFC Reading script step
Figure 2. Configure NFC Reading script step

When you execute your script, and it reaches this script step, FileMaker Go will display the standard iOS NFC scan dialog:

Screenshot of FileMaker Go with the
Figure 3. FileMaker Go waiting for the NFC scan

When you hold the phone close to an NFC tag (and remember that the iPhone NFC chip is at the top of the phone), it will read the data from the tag and run the specified script.

Screenshot of the script called when the scanning is done
Figure 4. Script called when the scanning is done

In that script, you capture the result of the scan with the Get(ScriptParameter) function.

That result contains multiple lines of information and not just the data on the tag. The FileMaker Pro help describes what is included (see Figure 5). Line 1 will tell you if the scan was successful or whether it was canceled or timed out, which is something you’ll want to parse out immediately and branch the rest of the script around. Note that not every line will always contain a value.

Screenshot from FileMaker Pro help describing whats included in the scan result
Figure 5. Information contained in the scan result

An NFC tag that contains just a string of text, for instance, will return the result, as shown in Figure 6.

Screenshot of the result from a scan containing just text
Figure 6. Result from a scan containing just text

A tag with a URL will result in, note that line 7 specifies the ‘data type.’

Screenshot that shows a tag with a URL
Figure 7. A tag with a URL

If you cancel the scan or the scan times out, you will get the results as shown in Figures 8 and 9:

Screenshot of the timeout error
Figure 8. Timeout error
Screenshot of scan canceled by the user
Figure 9. User canceled the scan

Other NFC Integrations

NFC scanning can also be integrated into your FileMaker apps in another way: Siri Shortcuts can be set up to start a flow with iOS itself, scanning a tag, rather than FileMaker Go doing the scan. Then in the Siri Shortcuts flow, you can use the new FileMaker Go 19 capability to have Siri call a script in your FileMaker app. This may prove to be useful if you need to take actions that are otherwise difficult to do from within FileMaker Go.

Next Steps with NFC in FileMaker Go

All in all, this new ability of FileMaker Go to read data from NFC tags is a very welcome addition that opens new possibilities. If you have questions or would like to enhance your FileMaker Go application, please contact our team.

8 thoughts on “NFC Scanning with FileMaker Go”

  1. Can u have a url in tag that runs a filemaker script.
    So the person doing NFC scan would not need FM GO to run the script? Run PSOS with Parameter?

    1. Hi Michael,

      The argument is a little circular: you can’t scan NFC tags without FM Go, unless you use some other iOS app to do the scanning but without FM Go the fmp URL would have nowhere to go…
      The only way you can scan an NFC tag with a mobile device and have it do an action in FM is to communicate through the FMS Data API. Either through a custom iOS app to do the full Data API authentication and communication or by setting up your own micro web service with a URL on the NFC tag and have your micro-service do the Data API authentication and communication.

      If you want to explore these options with us, let us know.

      1. My question is…Have you been able to call a fmp url from an nfc tag. So the fmp url could launch application and call NFC Reader scripting…

        1. Hi Michael,
          The NFC scanning discussed here wouldn’t work for that since it is initiated from inside FM to begin with, and returns the content of the tag as text (or now JSON) to the script you designate to run when the scan is done.

          In your scenario it depends on the application that does the tag scanning and whether it can instruct the OS to interpret the fmp URL. Sounds entirely feasible but I haven’t had to do it yet.

          Best regards,
          Wim

  2. Matt Revenaugh

    I see what Michael is asking. if we can store a url in a tag, can it be a fmp: protocol that opens FMGo when scanned by any reader software?

    Also, I appreciate these blog posts. Thank you

    1. Sure it can… but that is not dependent on 19, you can do that with any version of FM Go that supports the fmp:// url.

    1. Hi Tawanda, it depends on the tag. For all intents and purposes, NFC is a subset of RFID in that it uses radio waves to transmit information. RFID can be powered or passive, NFC is always passive, requiring the NFC reader to ‘power’ the radio on the tag. If you have access to the proper tags then try it.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top