QR Codes in FileMaker 12 & 13 — No Plug-ins, No Custom Functions


A while back I did a blog posting on generating 2D Bar Codes, or QR Codes from Google’s Chart API. The demo was created back in the dark days of FileMaker 11, before the advent of the Insert from URL function (FM12). In the old demo I used a Custom Function and a free plugin to capture the result in FileMaker. With FileMaker 12 and 13, this process is much simpler, so I have decided to redo the demo file. I have also eliminated the use of a Custom Function to make the script more portable — you should be able to just paste this script into your solution and modify two input fields and one output fields to get it working.

Aside from the more common marketing uses for QR Codes, one potential use that I have been exploring is to employ them with UUIDs on identity cards. UUIDs are Univerally Unique Identifiers and can be used in lieu of Serial Numbers in particular when solutions are generating IDs “without significant central coordination”. For example if part of your solution is on the road in the form of a FileMaker Go database and you want these records to sync up with a master database at the end of the day, then UUIDs might be a good option to consider. Developers have been generating UUIDs in FileMaker for a while, using Custom Functions, but since FM 12, FileMaker has had the capability of generating UUIDs using the new Get(UUID) function.

FileMaker generated UUIDs are 36 character random hexadecimal digits. For example: 37E0B374-9640-498C-A1B7-2A753BD153D1.

Obviously, UUIDs are longer than most serial numbers (also more likely to be unique, because they are a lengthy and randomly generated) and as a result, less likely to be typed in manually—ideal then for a bar code scanner. In addtion, because they are longer, they are also a good match for QR Codes which are designed to handle more data than a standard bar code.

For more discussion about using UUIDs in FileMaker solutions, see FileMaker Standards.

Demo File

QR Code Demo File

wpid5226-media_1387318996554.png

This is a very simple file.

  1. Enter some text in a record or generate a UUID
  2. Set the QR Code size (the field is set as a global, but it could be a regular field if you need to vary the size of your QR Codes)
  3. Push the ‘Get QR Code’ button
  4. Marvel at the cool QR Code.

The ‘Insert QR Code from Google’ API script

wpid5223-media_1387318627958.png

Modify the script for your solution

wpid5224-media_1387318646982.png

There are two areas of the script that will need to be modified if you paste this into your solution. 1) the setup fields: the Data and the Size and 2) the QR Code Container field.

I made the choice to make the bar code square. It does not have to be square, there is the capacity for the width and height variables to be different.

If your QR Code size will always be the same, you could skip the Size field and just hard code a number into $theSize variable.

The URL to send to the Google API

wpid5225-media_1387318678744.png

The script is forming a URL to send to Google, which returns the formatted QR Code. The URL syntax looks like this:

http://chart.apis.google.com/chart?chs=”&
$theSize
&”x”&
$theSize&
“&cht=qr&chl=”
&
Trim ( Substitute ($theData ; ” ” ; “+” ) ) &”&chld=L|1&choe=UTF-8″

Simple Portable Code

This is just a simple example of what can be done in FileMaker 12 to generate QR Codes. The script is designed to be easily portable to other solutions, so I encourage you to experiment with it and let me know of any intersting uses you come up with for the technology.

Related Posts

7 Responses to “QR Codes in FileMaker 12 & 13 — No Plug-ins, No Custom Functions”

  1. Sadly Urls don´t work with long Urls

  2. Great info! Thanx!

Trackbacks/Pingbacks

  1. QR Codes in FileMaker 12 & 13 — No Plug-ins, No Custom Functions | Filemaker Info - December 21, 2013

    […] See on hbase.net […]

  2. No Internet Connection, Can’t use Plugins, Need QR Codes? — Create QR Codes in FileMaker Pro using only Javascript | HomeBase Software - May 11, 2014

    […] while back, I wrote a blog and demo using FileMaker Pro to generate QR Codes. The technique employed Google’s API to generate a […]

  3. Create QR Codes in FileMaker Pro using only Javascript | HomeBase Software - FileMakerProGurus - May 12, 2014

    […] while back, I wrote a blog and demo using FileMaker Pro to generate QR Codes. The technique employed Google’s API to generate a QR […]