SSRS report to print labels from a roll - reporting-services

Does anyone have any experience of creating a report that will print labels that are on a roll?
I can see plenty of examples for a sheet of labels, but nothing with any great detail regarding a roll.
Would the best method be to set the report page up to have 1 column and then adjust the size of the page to be the size of the label?
There will be different info on each label, and a varying number of labels per print.
So basically set up the report to mirror the label size and then repeat pages depending on how many labels need printing?

You should just be able to set your report to have the same page size as your label then design the report as normal.
As for producing multiple labels, you can either
have a single dataset containing all the info you need for all labels and group by whatever makes each label unique (e.g. a label number). Then add a page break on the row group property to put a break between each, or ..
you could create a subreport that just handles a single label and then have a master report that with a table control with a single 'cell' and the subreport inside that cell. You would then pass the parameters to the subreport from the main dataset. I think you've seen a similar answer I posted about printing sheets of labels, if you follow that then it should get you most of the way there.
Option 1 is probably the simplest method...
Step-by-Step for option 1
In this example I've used the Microsoft sample database WideWorldImporters, just so I could get some names and addresses.
Step 1: Write your query to get your data. In my example I used the following..
SELECT top 10 o.OrderID, c.CustomerName, c.DeliveryAddressLine1, c.DeliveryAddressLine2, cty.CityName, c.DeliveryPostalCode
FROM [Sales].[Orders] o
JOIN Sales.Customers c on o.CustomerID = c.CustomerID
JOIN Application.Cities cty on c.DeliveryCityID = cty.CityID
ORDER BY OrderID
This just gives me the order number, company name and address.
Step 2: Create a new report. I'm using Visual Studio but the process is almost identical in Report Builder if you use that.
Create a new, blank report
Add a datasource and dataset containing your query from step 1
Select the 'body' and set the size property to your label size. I used 100mm, 40mm
Select the 'report' and set the PageSize property to the same values as above and the margins to 0
Step 3: Add a table to contain the data
Add the new table
Delete the header row
Delete the last column (I have a two column label in my example but obviously up to you)
Select the table (tablix) using the grey table handle (top left of the table) and then set the dataset property to the name of the dataset you created earlier
Add enough rows to contain all your data, in my case 6 in total
In the RowGroups panel under the main report design, right-click the details rowgroup and choose Add Group => Parent Group. Select OrderID as the field to group on and click OK
Remove the newly added column and if prompted choose 'remove column only'
Right-Click the (OrderID) Row group and go to Group properties, click Page Break and choose 'between'
Set each row to contain your data until you end up with something like....
Clean up the formatting and that should be it. One label per page and each page set to your label size.
You may need to adjust the layout slightly to adjust for margins etc but this should give you a good start.

Related

List report, filter by letter

I am building a summary report which looks at users that are marked in a database as having a common trait i.e return all users by name in the last 5 years whose contract contains an end date.
This generates a figure e.g. [250]
I drill through on that figure to give a list report of names, first name and surname.
I have ordered the list A-Z
I would like to add a row of 26 letters at the top of the report and have each letter return only the names with the corresponding starting letter.
Would this need to be a further drill through or is it possible to refresh the existing list based on a user-driven selection?
Just add a custom parameter to your report. Right click on Parameters and Add Parameter.
(and so on...). Default value should be All then.
Then simply add the following filter to your tablix:
'Expression:
=Switch(Parameters!YourParameterName.Value = "All", True, Parameters!YourParameterName = Left(Fields!YourNameField.Value, 1), True)
If you are just using SSRS as it comes, then you can't refresh report content without running the report again, so you would either
re-organise your current report.
need another drill through report.
Depending on your layout you could group the data by the first letter and then have an collapsible row group to show/hide that group of names. To do this simply add a parent row group, set the value, group value and sort value all to =LEFT(Fields!myNameField.Value). Next set the visibility of the details row group to hidden and set the toggle visibility property to point to the cell that contains the letter from the parent group you just created.
If you have too much data to make this efficient the you might have to go down the additional subreport route.
To make life a bit easier, and to save you having to create 26 links and parameter values, I would do the following...
Create a table that stores the list of letters
Add a matrix to your report, that has a column group grouped on the letter value from this table. This will act as your 'filter bar'
Set action on the matrix cell to "go to report", point to the final drill thru report and pass the [myLetterColumn] value as the parameter.
There's no need to set available parameters assuming this sub-report will be hidden and only called from the parent report.

How can I append the results of additional queries to an SSRS report?

I am generating an SSRS report whose results are displayed like so:
I need to append similar query results (same exact query, one different parameter value) to the right of this data, so that one additional result set of data (from a 2nd query) would look something like this (but with different data, of course - this is just copied-and-pasted to show what's needed):
How can I add multiple of these similar-but-distinct result sets so that they can be read from left to right as shown above?
Solution: COLUMN GROUPING
If I have understood your question correctly, you are expecting to show those 3 columns repeatedly for different set of values. All you need to do is put those 3 columns in a group (Column Group) and Group by on whatever "Field/Parameter" you want to it repeat. Let me know how it goes!!
Based on what is written here, this is how I accomplished this:
I created a new report based on the existing one, and then added a Subreport and then dragged the existing (original) report onto it (I dragged "VariancePricebyProduct_Facelift.rdl" onto the subreport in "VariancePricebyProduct_Facelift_WithSubreports.rdl"). Then I selected the context menu item "Subreport Properties" and added a parameter ("Unit"), providing it with a "hard-coded/baked-in" value ("CHOPHOUSE") different from the one to be provided by the user for the main report.
Then, since I want to keep the same date values from the existing report, I added two more parameters to the subreport and set them to use the same values for the date range as those used there in the main report by selecting the "formula" ("fx") button and 2-clicking the appropriate parameter to be used as the passed-in (tramp) value:
That works. Just to make it plainer, here is how it looks at design time:
The mess at the top is "VariancePricebyProduct_Facelift.rdl"; the bit below is a Textbox/Label for the subreport and then the subreport itself.
And here is how the data looks where the original/base report finishes and the subreport begins:

Show a message to the user instead of blank report [duplicate]

I am building an SSRS 2005 report using BIDS. My report filters on date. When the selected date returns no data rows the report is blank, just the title is displayed, no table or column heading.
How can I change this to display a message like No data available. or Report is empty.?
You could set the property NoRowsMessage available on the report's table control like this:
Select the Tablix control and press F4 to view the Properties pane.
Find the NoRowsMessage property and set the value to whatever message you'd like.
You can also to format the message using the Font and TextAlign properties.
Here are some examples of what the report will look like under various settings:
Further Reading: Here is a Technet article on how to Set a No Data Message for a Data Region
Avoid NoRowsMessage and build your own conditional empty row
One problem (or feature if that's what you want) with NoRowsMessage is that it'll literally replace the entire table with just a plain old message string.
Which provides a relatively counter-intuitive end user experience in my opinion. Normally when no data is found by a system, we'd like to know something about what data was being looked for and what it would have looked like.
Instead, based off how to keep the structure of the Tablix when there is no data to show, you can do the following:
Insert New Header Row, outside the group and above the details record.
Right click on the side of the new row and Set Row Visibility
Set Visibility to the following expression which will count the rows inside the current Tablix and only set Visibility to True if there is no data.
=CountRows() > 0
Optionally, merge the cells and add your own message or just display an empty row
Here's a comparison of how the various options will render: (pick whichever look you think best fits your data and use case)
Right-click on whatever databound element(s) you are using in the report and there should be a property NoDataMessage There are a host of options there but the Caption is the first element I would look at.

How do I display 'No data available.' when there are no rows to show on the report?

I am building an SSRS 2005 report using BIDS. My report filters on date. When the selected date returns no data rows the report is blank, just the title is displayed, no table or column heading.
How can I change this to display a message like No data available. or Report is empty.?
You could set the property NoRowsMessage available on the report's table control like this:
Select the Tablix control and press F4 to view the Properties pane.
Find the NoRowsMessage property and set the value to whatever message you'd like.
You can also to format the message using the Font and TextAlign properties.
Here are some examples of what the report will look like under various settings:
Further Reading: Here is a Technet article on how to Set a No Data Message for a Data Region
Avoid NoRowsMessage and build your own conditional empty row
One problem (or feature if that's what you want) with NoRowsMessage is that it'll literally replace the entire table with just a plain old message string.
Which provides a relatively counter-intuitive end user experience in my opinion. Normally when no data is found by a system, we'd like to know something about what data was being looked for and what it would have looked like.
Instead, based off how to keep the structure of the Tablix when there is no data to show, you can do the following:
Insert New Header Row, outside the group and above the details record.
Right click on the side of the new row and Set Row Visibility
Set Visibility to the following expression which will count the rows inside the current Tablix and only set Visibility to True if there is no data.
=CountRows() > 0
Optionally, merge the cells and add your own message or just display an empty row
Here's a comparison of how the various options will render: (pick whichever look you think best fits your data and use case)
Right-click on whatever databound element(s) you are using in the report and there should be a property NoDataMessage There are a host of options there but the Caption is the first element I would look at.

Access 2007 option group on report

I'm new to Access so please consider this when forming your response. This has been driving me crazy and I've looked high and low on the 'net for a solution. I look forward to your response.
I have a form with an option group. I've wish to have this display on my report. Take for instance this "test" scenario:
Options
a, b, c
I've created a field in my table to accept the data from the form. In my table, I see 1, 2, 3 when I save a record. Good enough. Now, in my report, I have checkboxes representing options a, b, and c. I wish to have a checkmark within the box corresponding to the option selected on the form.
There's no technical limitation preventing you from displaying output on a report using an Option Group and check boxes.
In the design view of the report, add an option group control from the controls toolbox.
Add 3 checkbox controls to the option group control. When you select the check box control and hover the pointer over the option group, it will change color to indicate that the check box will become a part of the group when placed.
I added three check boxes to an option group on a report and they defaulted to values of 1, 2, and 3, so this should go pretty easily for what you're trying to do.
In the Property Sheet with the option group selected, make sure the Control Source property is set to the column with the 1, 2, 3 value in the underlying data source.
You might want to set the border style to hide the box around the checkboxes and also delete the label control that is automatically generated for the option group. I'm not sure what kind of look you're going for, but I'm sure you can handle the formatting details.
An option group is a user interface object, and UI objects don't belong on reports.
Your data field stores digits, but each of those digits has a meaning. On a report, you want the meaningful data displayed. That means that you need a data table that maps 1, 2 and 3 to something, and then join that table to the field you're storing the option group value in.
Another approach would be to use Switch(), but that means that you'd have to edit the report any time you add another option. A data table makes that a lot easier, as you just add a new record to add a new value.