TIP: If you're having trouble viewing the images in this article; right click on the image and select open the Image in a new tab to view it at full resolution.
Introduction:
This article will show you how to add scan-able QR codes to a report based upon reporting data.
QR codes traditionally allow for storing URLs or other data that can be scanned by a camera to display what’s contained in the QR code.
They are useful for quick access to long web links or scanning data quickly.
Contents:
QR Code Example
See below example of an Invoice QR code scanned showing the Debtor and Order Key:
Instructions - Adding a QR code to a report
-
A single QR code can be generated per query only (ShowBarCodeOnEveryRow setting will allow a QR code per row for the query).
-
To add multiple QR codes with different columns, multiple queries are required.
-
QR codes can be added to RDL template reports only.
-
Only the columns available to the query may be used for QR code generation (Lookup expressions and formatting expressions are not available)
-
'Custom property' (custom values) columns may also be added to the query to be included in the QR code.
In this example, the QR code should contain the Invoice number, InvoiceAmountDueFormatted, PaymentDueDate
-
Navigate to the Reports (Administration) page and search for the report that requires a QR code.
-
Click ‘Select’ on the report and ‘Select’ on the query. Then click ‘Edit’ on the ‘Column’ that should be part of the QR code.
-
Tick ‘Is included in QR code’ and add a sort number to the ‘QR code sort index’. This column will be added to the QR code, and the sort index will define where the column should be placed in the QR code text if there are multiple columns (sorts by lowest number first)
-
Do the same for all required columns to show which columns and the sort for the QR code string
-
Ensure that the ‘QRCode’ column is added to the query to show the QR code in the report.
-
To ensure that the RDL template contains the ‘QRCode’ column, generate the template via the ‘Download template’ button - this will give a copy of the template with the latest columns added.
-
-
Open the file in Report Builder and insert a new image to the report.
-
On inserting the image, change the ‘Select the image source’ to ‘Database’
-
Insert expression ‘=First(Fields!QRCode.Value, "InvoiceLine")’ in the ‘Use this field’ field & Change the ‘Use this MIME type’ to ‘image/jpeg’ and click 'OK'.
-
Note: =First(Fields!QRCode.Value, "InvoiceLine") example should be used only if ShowBarCodeOnEveryRow=false, otherwise (ShowBarCodeOnEveryRow=true) it's just the usage of the field in that particular context: =Fields!QRCode.Value
-
-
Run the report inside Report Builder before upload to ensure that the report runs correctly without error.
-
Save the RDL file and click ‘Upload template’ to upload the template to the Invoice report.
-
The QR code is now added to the report displaying a scannable QR code image. Displaying when scanned the Invoice Number, Amount Due, and Payment Due date.
Note: In the case of batch invoices and if the QR code should only be on the cover page then the following visibility formula can be used =First(Fields!IsSinglePageInvoice.Value, "InvoiceLine") = false
QR Code column formatting
Columns chosen to be included in the QR code can have formatting applied to display when scanned (if none specified default output for the column will apply).
Examples:
Column formatting |
Description |
Example |
---|---|---|
dd-MMM-yy |
Date format for date columns see C# date formatting for more information |
17-Nov-21 |
$#.00 |
Used for numeric columns displaying the currency with two decimal places |
$100.00 |
HH:mm |
Time format for time columns see C# date formatting for more information |
12:00 |
$#.00 (Tax) |
Used for numeric columns displaying the currency with two decimal places and text added at the end. |
$20.00 (Tax) |
Is Active: {0} |
‘{0}’ is used to display the string output for the column, allowing a prefix or suffix. |
Is Active: TRUE |
QR Code settings
The following settings can be added to the data provider settings (separated by a semi-colon ';')
Setting |
Type |
Default |
Description |
---|---|---|---|
MultipleValuesSeparator |
String |
“ “ (empty space) |
Allows adding a separator between values if multiple columns are generating the QR code. Default is an empty space, to remove the empty space, add ““. |
ShowBarCodeOnEveryRow |
Boolean |
FALSE |
Allows generating a QR code for each row generated from the query. E.g. if using the Order’s query, a QR code can be generated for each row’s Order Key. If FALSE then the first QR code value from the columns is taken. |
PixelsPerModule |
Integer |
20 |
The pixel size each black and white module (square) is drawn. |
ECCLevel |
String |
Q |
Error Correction Level. See wiki page for more details on wikipedia: QR code. Possible values:
|
UseTLV |
Boolean |
FALSE |
Enables Tag-Length-Value (TLV) Base64 format for QR codes, encoding the QR code. |
Related Content:
Comments
0 comments
Please sign in to leave a comment.