MightyData

FileMaker and WordPress Consultants

  • Company
    • About
    • Contact
    • Team
    • Artists
  • Services
    • Consulting
    • Development
    • Our Process
    • Coaching
    • Training
  • Results
    • Customers
    • Success Stories
    • Testimonials
  • Blog

Scanning Barcodes with FileMaker Go – Part 2

November 8, 2012 by Anders Monsen 35 Comments

Mobile app to scan or swipe data with iPhone

This is part 2 in a 3-part series.

In Part 1 of this 3-part post examining bar codes, magnetic strip readers, and FileMaker Go, we looked at the tools necessary to integrate all the components into one FileMaker Go solution. We will focus on just the bar code and FileMaker portion here. The necessary resources are listed in part 1, and the card reader portion will appear in part 3.

To create the FileMaker Go app, we create the database up in FileMaker, and then place the app on the iPhone or iPad (via iTunes or web page, for example). Since the device is mobile and connection to a networked file can get iffy, there are advantages to having all the action local on the device, at least initially. Later, you can sync the data with the server though a variety of methods (GoZync, MirrorSync, etc). We created a simple test database (see demo file below). This file contains both the scanning and bar code reading capabilities.

The Interface

The database front end is fairly simple, and consists of a field that stores the data, plus three buttons. The Scan button handles a single scan, and could be set up for either pic2shop or CNS Barcode. The Swipe button opens the CardSwipe reader app, while the Multi-Scan button works only with CNS Barcode.

Mobile app to scan or swipe data with iPhone

Pic2Shop

The first app, Pic2Shop, scans a single barcode, or EAN number. (EANs are 13-digit barcodes, but pic2shop will still scan older ISBN10 numbers). A good starting point is to create a button that launches the script, such as “Scan”. This script in turn launches a script to open the barcode app. In the sample database we have both the pic2shop and CNS Barcode available, and you can comment out one or the other while testing each method. We have a parameter in place to handle the two different buttons, the individual
Scan”, and the “Scan Multiple”. The “Open barcode app” scrip contains the key line, which is the “Open URL” script step. Inside this step you build the URL scheme to send to the iOS app – pic2shop or CSN barcode. The callback requirements must have the EAN string in the url, and for FileMaker 12 this looks something like

pic2shop://scan?callback=fmp://$/GoInput?script=Scan¶m=EAN

This url breaks down as follows:

  • the app: pic2shop://scan?callback=
  • the callback app, in this case Filemaker: “fmp://” for FileMaker Pro 12
  • the location of the FileMaker app: $ for an application already open on the phone (~ to open a database on the device, and hostname if hosted remotely)
  • the file name: GoInput
  • the script: Scan
  • the parameter: EAN (the barcode read by the app)

The url needs to be encoded to handle certain characters, and so the URL would change to this:

pic2shop://scan?callback=fmp%3A//%24/"&Get(FileName)&"%3Fscript%3DScan%26param%3DEAN
Characters Encoded
Dollar $ %24
Space %20
Equals = %3D
Ampersand & %26
Colon : %3A
Question Mark ? %3F

The last piece, the “Scan” script, handles the data received from the device. Since the barcode resides in the parameter, your script simply needs to insert the data into a field. Before looking at this script, we’ll switch over to see how CNS Barcode behaves.

CNS Barcode

The only variation we used was to enable the multiple scanning option on CNS Barcode, and this was set up via the script parameter and a Case statement inside the URL. If you are scanning multiple barcodes, having to click the scan button each time can slow down the process. However, one caveat is that CNS Barcode in this mode appears very sensitive and will scan very quickly and often the same barcode multiple times, and in some cases scanning a portion of the barcode that you don’t want. Instead of the full EAN 13 you might end up with a five digit number. When scanning multiple barcodes, all the barcodes appear in one return-delimited list in the clipboard. This list then is pasted via the script into one field in FileMaker. To split out the items, you could either extract the unique values in the script or using a custom function, and then loop through the unique values to create your records in FileMaker. The CNS Barcode Open URL script step then looks like this:

"cnsbarcode://scan?" &
Case ( $param = "multiple" ; "scanmultiple=yes&" ) &
"launchurl=" &
GetAsURLEncoded ( "fmp://$/" &
Get ( FileName ) &
"?script=scan¶m=::barcode::" )

A simple Case statement checks whether we chose a single or multiple scan. Next, add the launchurl to the FileMaker database (the name of the file), and the ::bardode:: parameter (just like EAN for pic2shop). The Open URL calculation is broken down into respective parts, but really is one continuous URL.

The Scan script itself places the barcode into a text field. With multiple data you would loop through and create multiple records.

Set Error Capture [ On ]
Go to Layout [ “Input from Barcode” (zSystem) ]
If [ Get( TotalRecordCount ) = 0 ]
 New Record/Request
End If
Set Variable [ $code; Value:Get(ScriptParameter) ]
If [ not IsEmpty($code) ]
 #
 If [ PatternCount ( $code ; "Multiple" ) ]
   Paste [ zSystem::gScanData ]
 Else
   [ Select; No style ]
 Set Field [ zSystem::gScanData; $code ]
End If
Commit Records/Requests
#
End If
#
Go to Layout [ original layout ]
Set Variable [ $Barcode; Value:zSystem::gScanData ]
Loop
  Exit Loop If [ Let ( $i = $i + 1 ; $i > ValueCount( $Barcode) ) ]
  New Record/Request
  Set Field [ ScanInfo::inputText; GetValue( $Barcode ; $i ) ]
  Commit Records/Requests
End Loop
#

This script creates a new record for each scanned item. In theory once you have a valid barcode you can reach out to other databases and get additional information if required, or a custom barcode would be written to contain all the information that you need.

Scanning barcode with an iPhone

Note the number in the red circle at the bottom. When scanning multiple items you can see how many are currently in memory. You can view the details by clicking on this icon.

Data from multi-scan mode in CNS Barcode app

Note the first item in the list, which contains ALL the numbers from the barcode, including the smaller barcode section, whereas the others are all ISBN numbers. In your database if you are scanning books, you would need to validate the numbers before trying to pull additional information.

barcode-data-in-cns-app

Finally, when you click done, the app switches back to FileMaker via the callback section in the Open URL script step.

Data from barcode in FileMaker Go

CNS Barcode’s multi-scanning action seems to quickly scan the same number multiple times, and also sometimes scans barcode numbers other than the ISBN10 or 13. Possibly there are some settings that might limit such behavior. Otherwise the multi-scan mode significantly speeds up getting that barcode data into FileMaker without switching back and forth between the apps.

The sample file: GoInput.fmp12 applies also to the magnetic strip reading process in part 3.

GoInput.fmp12

Filed Under: Barcodes Tagged With: CNS Barcode, Demo file, FileMaker 12, FileMaker Go

Using Barcodes and Magnetic Stripes with iOS

October 10, 2012 by Kirk Bowman 10 Comments

Scanning / swiping iOS prototype

The other day, Anders Monsen and I were prototyping a custom iPad app to help a stage company manage work crews for large arena events. Each event has multiple shifts (7am, 7:45am, 8:30am, etc.). At the start of each shift, several employees need to clock-in quickly and receive their work assignments.

We researched two ways to identify an employee with an ID card: scanning a barcode and reading a magnetic stripe. We found three apps in the App Store that can integrate with FileMaker Go, two for scanning barcodes and one for reading a magnetic stripe using a third-party card reader.

I really enjoy exploring the usability of a solution during prototyping. In this article, I will share some of my observations for this use case. Anders will explain the technical side of integrating FileMaker Go and iOS apps with URL scripting in a separate articles.

Observations

For the prototype, we created a simple layout with two buttons, Scan and Swipe. The purpose of each button is to switch to the companion iOS app, perform the scan/swipe, and return the data to a text field in FileMaker Go.

Scanning / swiping iOS prototype

Scanning / swiping iOS prototype

Some of my preliminary observations include:

  • Holding the iPhone – I am right-handed so I visualize the user holding the device in his left hand and the ID card with his right. I liked cradling the iPhone in my left palm (portrait orientation), allowing my thumb to tap the buttons.
  • Holding the iPad – With the iPad, weight is the determining factor. I liked balancing it with my hand halfway between the top and bottom edges (portrait orientation). Again, my thumb was available to tap the buttons.
  • Button Design – Larger buttons that are easier to tap. I made the button height 50 points for the iPhone and 72 points for the iPad. To tap a button with a thumb, I made the buttons extremely wide, 75% of the iPhone screen and 85% of the iPad screen.
  • iPhone Case – For this app, a case cannot block the camera, which scans the barcode, or the dock connector, which connects to the third-party card reader. A thin case like the Fitted for iPhone 4 from Speck works nicely.
  • iPad Case – Besides working with the camera and dock connector, a case will need to help the user grip the iPad. A thin case with a rubber texture like the NGP Semi-Rigid Shell from Incipio is a good match.
  • Camera – For scanning a barcode, the device needs a good auto-focus camera. For this solution, we need either an iPhone 4/4S/5 or Retina display iPad. Of course, reading a magnetic stripe does not have the same requirement.
  • Barcode App – For scanning barcodes, we tested pic2Shop (free) and CNS Barcode ($9.99). I selected CNS Barcode because it is designed for FileMaker Go, scans more accurately, and supports scanning several barcodes in rapid succession.
  • Mag Stripe App – Reading a magnetic strip requires an app that can communicate with an external card reader and supports URL scripting. CardSwipe ($15.99) is designed for FileMaker Go and is the only app we found that meets these requirements.
  • Card Reader  – The iMag Pro MagStripe Reader ($60-$70) is the only card reader that CardSwipe supports. It plugs into the dock connector on the iPhone and iPad. So far, my only concern is it can become slightly unseated when aggressively swiping a card, especially with the iPhone.

In the end, our customer decided to scan barcodes with CNS Barcode. And, now we have knowledge of using magnetic stripes for future projects.

Filed Under: Barcodes Tagged With: CNS Barcode, FileMaker 12, FileMaker Go, Magnetic stripe

Scanning Barcodes with FileMaker Go – Part 1

October 8, 2012 by Anders Monsen 10 Comments

This is Part 1 of a 3-part series.

A smartphone today does far more than make calls. With a variety of apps available we have access to a world of information at our fingertips, or hours of distraction. Productivity is vital from the business side of mobile computing. Reading and storing data is one powerful aspect, but collecting data on the device makes our information interactive. Getting data on to the device quickly and error-free becomes imperative for any business.

FileMaker Go is a perfect tool for storing data on a iOS device like the iPhone and iPad. But, the lack of a physical keyboard makes data-entry a slow and tedious affair. Scanning bar codes or reading magnetic cards like credit cards, drivers licenses, and so forth, enables fast access to data. This three-part article first will discuss the requirements to pull data into FileMaker Go from an iOS device, and then demonstrate two different methods of adding data.

First, your iOS device will require some software and hardware. FileMaker Go is free, though you will need to develop your database using FileMaker Pro on the desktop. To read bar codes I have used two different apps. One, Pic2Shop, is free and performs its task fairly well, though it is limited to scanning one item at a time. CNS Barcode costs $9.99, but adds a variety of features such as multi-scanning, and also can create bar codes.

To read magnetic card strips the cost climbs. You will need a paid iOS app ($15.99), CardSwipe, and a small device that plugs into your iPad or iPhone (this was tested prior to iPhone 5), such as iMag Pro, around $60. With iMag Pro you can run cards through the reader from the context of the CardSwipe software.

The glue that binds the app and FileMaker Go database is called a URI scheme or protocol. When you build your FileMaker app (you’ll have to wait for part 2!), you create scripts that call the iOS app with their URI scheme. In that URI scheme you then have a callback action to FileMaker using its URI scheme, indicating the database name and the script to run.

With the exception of Pic2Shop, you must pay for the companion app. In part 2, we’ll switch over to FileMaker and see how to set up the database, and how to pull in the data without typing a single character by scanning a barcode. Part 3 will cover reading information from magnetic strips, such as drivers licenses or credit cards.

Filed Under: Barcodes Tagged With: CNS Barcode, FileMaker 12, FileMaker Go, Magnetic stripe

Let’s get started on your project.

It will be more fun than you think.

Get in Touch

  • Company
  • Services
  • Results
  • Blog

Copyright © 2023 · Parallax Pro Theme on Genesis Framework · WordPress · Log in