Streaming Barcode Images in Microsoft Report Builder
In this tutorial, the IDAutomation SSRS Generator Service is used to stream linear barcodes in Report Builder, which is a report authoring tool included with Microsoft SQL Server and SSRS (SQL Server Reporting Services).
This example uses the free demo version of the SSRS Generator Service, which contains a watermark at the bottom of the barcode symbol. The purchased version of the script does not contain the watermark.
Overview
Barcodes can be easily implemented in a report by placing the SSRS Generator URL into a Text Box value and setting the URL parameter to a desired field. When the report is run, barcode images are streamed into the report.
The unique SSRS Generator URL is obtained after purchase. To demo the solution, the following URLs may be used for evaluation purposes only:
- Code 128: https://www.bcgen.com/ssrs/demo-c128.aspx (The URL used in this tutorial)
- Data Matrix: https://www.bcgen.com/ssrs/demo-dm.aspx
- QR Code: https://www.bcgen.com/ssrs/demo-qrcode.aspx
Report Builder Barcode Tutorial
Applications used in this Tutorial:
- IDAutomation SSRS Generator Service
- Microsoft Report Builder 3.0
- Microsoft SQL Server 2012 & 2014
Tutorial
NOTE: The tutorial assumes Report Builder is properly installed and that the Barcode Generator Script is implemented and functioning. Within this tutorial, the demo version of the SSRS Generator Service is used for evaluation purposes only.
- To run Report Builder, double-click the application icon.
- To create a new report, select New Report and then select
Table or Matrix Wizard.
- Select Create a Dataset and choose Next.
- For Data Source Connections, select New.
- In the Data Source Properties, select a Name, choose a connection type, and select Build.
- In the Connection Properties, select the Server name, and the
database. In the example, the database name is Barcode. Select
OK.
- The Connection string should include the Server name and database. To verify the connection, select Test Connection. If the connection string is successful, a 'Connection Created Successfully' message will appear. Select OK.
- Once the Test connection is linked, select Next.
- The Design a query allows the user to select fields for the
report.
- To view or edit the query, select Edit as Text. If the report does not need a query edit, select Next.
- Choose the fields that will appear on the report. Select Next.
- Choose a layout for the report.
- Choose a style for the report.
- To view the report, select the Run button near the top
left corner of the application.
Report View:
- To return to design mode, select Design.
- Choose Insert - Text Box. Jump to Microsoft SQL Server 2014
Instructions.
- Drag the Text Box to the report and place it within the field
area. In the example, the Text Box is placed underneath the Number
field.
- Select View and enable Properties.
- In the
Text Box properties, expand the BackgroundImage and complete
the following steps:
- Set the Source to External.
- Set the Value to the SSRS Generator URL and append
the desired field.
The example uses the demo URL and sets the DataToEncode (parameter D) to the Number field:
="https://www.bcgen.com/ssrs/demo-c128.aspx?D=" & Fields!Number.Value - A MIMEType image setting is not required.
- Set the BackgroundRepeat to Clip.
- Save the report.
- Run the report. If the Text Box does not display the full barcode in report view, return to design mode and adjust field height and width.
- This example uses the demo version, which contains a watermark at the bottom of the barcode
symbol and is for evaluation purposes only. The
purchased version of the product does not contain the watermark.
Microsoft SQL Server 2014 Installation Instructions
This version requires an additional column to be added to display the barcodes instead of adding only a text box as in the 2012 version.
- Right Click on the last column and add a column to the right.
- Then right-click in the field where the barcode is desired to appear, select Text Box Properties..., expand the BackgroundImage section, and choose the expression that matches the field information from the Value options.
- Now go back into that BackgroundImage Value field and change the
default expression
as follows:
- From:
=First(Fields!Sku.Value, "DataSet1") - To:
="https://www.bcgen.com/ssrs/demo-c128.aspx?D=" & Fields!Sku.Value - And set the BackgroundRepeat field to Clip.
- From:
- Run the report and verify that the area is large enough to display the barcode completely.
If a scanner is needed, consider purchasing the IDAutomation USB Barcode Scanner.