Display Barcodes from Dataset
The most common reporting services usage is generating reports from table data from datasets. BarcodeGenerator visual component can generate barcodes from dataset or any expression data as well as any other Report Item. In this article we provide information how to generate reports with barcodes support from any DataSet.
How to Generate Report with Barcodes Support from Dataset
- Create blank report project and attach DataSource and DataSet to the project. You can see from these examples how to add DataSource and DataSet to the report.
As an example, for the article, we use test Microsoft Access database with the table Phones with the following fields.
Table Name: Phones
|id||Auto number. Used as primary key|
|Model||Model description, text field.|
|OS||Operational System description, text field.|
|Serial||Serial number, text field.|
After attaching DataSet to the project, you should see on the Report Data toolbox something like this:
- Drag-and-drop Table report item on report surface.
- Drag-and-drop BarcodeGenerator visual component to any of Table column. The next, right click on BarcodeGenerator component and select Resize to Default. This resizes component to default size with current parameters.
- Drag-and-drop data fields from Report Data toolbox to the table columns. Put fields Serial to BarcodeGenerator component.
- Now as example you can change barcode properties. Set BarcodeType to Pdf417. As you can see CodeText value is set to expression value =Fields!Serial.Value which is represent field identifier. All values, detected as Expression in design mode, the component renders as word EXPRESSION.
- Now you can see the full dataset, rendered as report. You can deploy the report to SSRS server or just pass to Preview section.
Tips and Tricks
BarcodeGenerator visual component renders all values, detected as Expression in design mode, as word “EXPRESSION” instead of real expression value. The real value can be seen on Properties toolbox.
The DataSet fields can be just drag-and-dropped on the component. The behavior is similar to other Report Items.
Some BarcodeGenerator component properties like CodeText, Caption text values or TwoDDisplayText can accept Expression values which are resolved in runtime.
Right click on BarcodeGenerator component and select Resize to Default is a simplest way to obtain most correct barcode size.