SSRS Report - Use column for page breaks, but make invisible - reporting-services

I'm using SQL Server Data Tools 2012 in Visual Studio. I have a Reporting Services report containing a table with some columns that are optional, based on selections from a multivalued parameter, and other columns that are required.
Among the required columns, the first two - call them SalesOutlet and ProductType - are to be used to create separate worksheets when downloaded to an Excel spreadsheet. For instance, I want a worksheet for each of these combinations:
"Springfield" + "Books"
"Springfield" + "Music"
"Portland" + "Books"
... etc. Since these columns are used to create the separate worksheets, it would be redundant to show them in the sheets, so I want to hide them.
I can create the separate worksheets by making SalesOutlet and ProductType be row groups and selecting page breaks "Between each instance of a group" in the Page Breaks tab of the Group Properties dialog. However, if I then go to the Visibility tab and select to Hide the groups, it hides all the columns in my report, since Hide will hide all columns of a group.
How do I use columns for grouping and page break criteria, and hide them in my downloaded result, while still showing their child member columns?

Say you have some data like this:
And a simple report to display the data:
Note that the only column being displayed is Title. However, we are grouping on the other two to create the required group and page breaks:
Don't forget to set up the group-level PageName property to something like:
=Fields!SalesOutlet.Value + " " + Fields!ProductType.Value
To get named worksheets:
This gives the required results of grouping/paging on columns that aren't actually displayed in the report:

It turns out that you can delete the group columns after you've specified them to be used for grouping and page break. You simply right-click on the the handle of the column(s) to be removed and select "Delete Columns" -> "Delete columns only".

Related

SSRS report to print labels from a roll

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.

Use expression in access report textbox

I have a MS access report that I want to run using a linked excel table (so i cannot make any changes to the table in access).
The report has a text box which takes each row in the table and displays it in the text box and later prints it. I want to add a "*" at the beginning and end of the string and then display it in the text box.
I have done this so far:
- Choose data source (excel linked table) from report view
- In design view, press alt+F8 and drag and drop the column header I want into the report.
When I run the report it shows the report on each page, one page for every row of data which I will print later.
Now in design view after clicking on the text box, I go to property sheet and then the "Data" tab, if I try to change the expression to:
="" & [tablename].[headername] & ""
EDIT: There is an "asterisk" sign between the " " above, i don't know why they don't show.
When I run the report it asks me the parameter for the row number I want and displays the report only for that row. How can I use an expression and still be able to get all rows in the report in different pages?
Thanks!
I did what I didn't want to in order to get the problem solved. I used a query to add an additional column (using an expression) and used the query as my data source. Doesn't look like there is a good way to use the report to directly make changes to the table data and show it in a textbox.

SSRS - Display current grouping field values in report page header

I'm using SQL Server Data Tools 2012 (Visual Studio 2010) and have a multi-tab report that does a page break on each combination of SalesTerritory and ProductType.
I can label the worksheet tabs of the resulting downloaded Excel spreadsheet by adding a group-level PageName property expression in the Properties window that concatenates the two current grouping criteria values:
=Lookup(Fields!SalesRegionID.Value, Fields!SalesRegionID.Value,
Fields!SalesRegionCode.Value, "SalesRegion") + " " +
Lookup(Fields!ProductTypeID.Value, Fields!ProductTypeID.Value,
Fields!ProductTypeName.Value, "ProductType")
What I'd like to do now is add the same string to the page header of each report page. I can't simply add the above expression in a text box since "field references outside of a data region must be contained within aggregate functions which specify a dataset scope."
So, how do I scope the references in order to display the same string on both current tab
and the page header of each worksheet?
It turns out that the PageName property that I assigned at the group level is also available as a global field. If you add a text box to the page header and open its expression dialog, you will find a field in the Built-in Fields category called "PageName". Double-clicking this will add the following expression:
"=Globals!PageName"
That does it!

RDLC in VS 2010, how to display dynamic data in a table row

I have my report and data ready. The report is like i need to select a center name (Ex: Raleigh(0003) ) from the DDLB. and i will submit that. Now i will get the report for the Raleigh Center. Here, i need to see the text on the top of the report like "Weather Report for Raleigh (0003)" as a header. Whenever i select a different center, it should automatically display that particular center on the top of the report.
I tried to add the table, give the column (CENTER_ID) from the data set and in the expression, i gave like --> ="Weather details:"& Fields!CENTER_ID.Value &" - " & Fields!CENTER_NAME.Value. Here is the issue, it's either displaying all of the centers row by row or displaying a particular center name irrespective of the selection. Please help me out as it is very important.
Thanks.
When you select a center from the drop down - it is populating a parameter that you must then be using either to filter the query or to filter the table. Depending on how many rows the full query returns it might be better to do one or the other, e.g. if there are 1000's of rows you should filter the query, not the tablix. If it's not many rows then it's fine to filterthe tablix.
If the parameter is called #center then you could use this formula in your header:
="Weather details: "& Parameters!center.value
This assumes that your paramater is "text" type. If it is numeric or a date then you might have to convert it to a string first using CStr().
="Weather details: "& CStr(Parameters!center.value)
The reason it was showing you a "particular center name irrespective of the selection" is because you were telling it to put a dataset column (many rows) into a single cell. That will force it to always display the value in the first row, or if you are putting it in a details row in the tablix it will output every single value.
If you filter the query rather than the tablix, you could reliably use this:
="Weather details:"& First(Fields!CENTER_ID.Value,"datasetname") &" - " & First(Fields!CENTER_NAME.Value,"datasetname")
because the first() function will return a single value from the first row of the dataset.

Display data in SSRS

I have two tables on the SSRS report which displays data depending on the results returned by a single dataset.
The second table displays a subset of data which is displayed on the first depending on some parameters.Now I would like to implement a functionality which displays "no rows" in the second table if the countrows=0 (subset returned from first table) and display the data(subset of data in the first table) if the countrows>0
How can I implement this?
There is a property on the table called "NoRows" that allows you to enter any text you want to show if there are no rows returned.
you can also use this solution:
for your dataset2 click the tablix and at the bottom you shall have Row groups. Click on each of the row groups. So if you have 1 child and 1 parent you will have to do this on both.
1) Right click group_child->group properties->filters and put the following expression "=IsNothing(Fields!Group_Child.Value)="True"" "; set it as boolean expression and 'value'='False' and you will have to do same for Group_parent1 thru n.
This will display NO rows if you have NO data for bottom dataset. If this is the same thing you want to do with Tablix 1 go for it.