Thanks for coming to InDesignSecrets.com, the world's #1 resource for all things InDesign!

Data Merge QR Codes Explained

Data Merge QR Codes were a feature added to InDesign CC 2014. The instructions provided by Adobe for creating variable QR codes in InDesign may provide a false sense of security for most end-users.  Adobe’s help site shows the QR code feature as “Enhanced Data Merge” towards the end of the page, and spells out the specifics of how the code must be written.

This said, it means that QR codes are not applied the way most users would imagine. For example, if someone wanted an email address to appear as the QR code so that the result (once scanned) will send an email to a given address, it means they cannot use a field already in a database and apply the QR code field from the Data Merge panel. Instead, a new field must be created specifically for the records that are to appear as QR codes.

Here are the essentials:

  1. The record that contains the information to become a QR code must be a field of its own
  2. The field header must have a hashtag at the start of the field name (e.g. #code)
  3. The codes will always display as black, though the background color can be changed.
  4. The QR codes have to be written containing any necessary metadata specific for their purpose.

This is where most InDesign users may encounter problems, especially if they are unfamiliar with QR code metadata, and how to easily apply this metadata to existing information in a database. Before tackling this issue, it is important to understand what is going on. Put simply, at the start of the QR code, there is information that tells the QR code reader what kind of data is about to be parsed, for example:

  • SMSTO: send an SMS;
  • URL: load a web page in a browser;
  • TEL: call a given telephone number

It is also possible to include more information so that the QR code reader can provide further information for the code being scanned, such as names and addresses for “virtual card” information.

The Adobe Help page lists five different ways that the metadata can be written, such as Plain Text, Web Hyperlink, Text Message, Email, or Business Card. However, any metadata available for QR codes can be used, provided the metadata is written correctly. This allows the QR codes to contain information such as Geo-location coordinates. A list of ways of writing the metadata can be found on this page.

It is also of note that there are several ways to write the code for contact information. While the Adobe Help page suggests using the VCARD method, the MECARD and BUSCARD methods also work.

As for the code to send an email, I initially had difficulty following the instructions on the Adobe Help site, so I used an alternative coding method – the W3C standard (rather than the MATMSG standard as suggested in Adobe’s Help). Eventually, I discovered that the code on Adobe’s Help page is incorrect:

qrcode1
MATMSG:\nTO:johndoe@adobe.com\nSUB:Hi;\nBODY:;;”

It is missing a character and contains unnecessary data. It should read:

MATMSG:TO:johndoe@adobe.com;SUB:Hi;BODY:;;

The problem – the semi-colon was missing before the SUB, and the \n (new line instruction) is not necessary given that the semi-colons indicate the end of a line.

So, the question is how to use a database that has no dedicated QR code field so that InDesign can apply variable QR codes. Assuming the data is supplied as a Microsoft Excel spreadsheet, the answer lies in a formula type called Concatenation.

For example, take the following cards that need a QR code to email the consultant. The Excel file only contains the email address of the consultant, so a new field that will become the syntax for the QR code must be created. In this example it will be called #Qremail.

qrcode2

To accomplish this task, use the concatenate function of Excel. This function is used when entries in several cell must appear together in the same cell.

In the first empty row of the newly created field, use the formula builder to create the following formula that includes the concatenate function.

=CONCATENATE(“MATMSG:TO:”,E2,”;SUB:Hello “,B2,”;BODY:;;”)

qrcode3

This will give the following result based on the email entry in the first row:

MATMSG:TO:a.baum@allonsy.com;SUB:Hello Adam;BODY:;;

Entering the syntax in this fashion will yield an email that is sent to the email address, and contains a subject line:

Hello First (where First = the first name of each person in the database above)

This example uses an email address, but it also demonstrates the power of the Concatenate function. If you’re creating QR codes for virtual cards, I would definitely recommend using a similar procedure utilizing the Concatenate function.

This formula can now be copied for the rest of the spreadsheet, and the spreadsheet saved as a tab delimited text file (CSV is possible, but the tab delimited text file format is my preference when dealing with complicated punctuation, as the database is less likely to create unexpected side effects thanks to a wayward comma or quotation mark). Close the newly saved .txt file before returning to InDesign.

Once back in InDesign, select the data source from the Data Merge panel and choose the newly saved .txt file. Once updated, the panel will indicate what fields will yield QR code information with a QR code icon. Once a QR code placeholder has been placed into an InDesign file, it displays with a blue dotted line.

qrcode4

The file can then be merged to a new file or PDF for output with the QR codes displaying correctly. Try scanning the sample below!

qrcode5

Colin Flashman

Colin Flashman

A prepress operator and graphic designer for a South Australian commercial printer, with close to 20 years of experience in the trade. He is also a regular contributor to this site and InDesign Magazine, and hosts his own prepress blog "Colecandoo".
Colin Flashman

Latest posts by Colin Flashman (see all)

  • - November 30, -0001
Tags
Related Articles
Comments

9 Comments on “Data Merge QR Codes Explained

  1. Great explanation, Colin!
    One thing to add: I have found that different QR code readers are better (or worse) at supporting different QR codes. Everyone supports the basic hyperlink, but some of the others (especially the VCF files) won’t work on some readers.

  2. I have to do 996 business cards. So I need to do vcards for all this names. Is there a comprehensible way to do this?

  3. mail merge from excel with QR code into InDesign

    In regards to the mail merge when I go to merge the Qr codes the number merges and not the image of the QR code itself.

    I think that this is a result of the excel spreadsheet not having the correct formula telling in design what to do with the code.

    I can create a single Qr code and input them manually which will take some time as there is 700 – 1000 names

  4. Found this article VERY helpful. Thank you. I am trying, however, to use a TAB keystroke between data fields when concatenating multiple fields into one. I’ve been online searching (for hours) for a solution and have tried all various types of commands and ASCII codes (specifically variations of HT, 9, 09, ~009, etc.) but my scanner just reads these as text. However, when I use a free online QRcode generator, and paste in text with tabs (physical keystrokes), the scanner reads it perfectly. So there MUST be something there, but it still eludes me. Any ideas??

Leave a Reply

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