SSRS rows in tablix outside group goes to next page - reporting-services

I have a SSRS report that looks like the following:
Report Header:
Page X of Total Page Y (based on change of Customer ID)
Customer ID (Referring to ReportItem!CustomerID)
Report Body:
A tablix page break by change of group Customer ID
Tablix Header: Date | Price | Quantities | Description | Hidden Column Customer ID
Tablix Details: YYYY-MM-DD | 1.00 | 500 | Blah Blah | Customer ID (used for page header referring)
Row outside group: Empty
Row outside Group: Sum of Price
Row outside Group: Sum of Quantities
Row outside group: Empty
Row outside group: *** END OF RECORDS ***
Report Footer:
Company address
Occasionally, the Row outside group will go to next page if the report body for the tablix details are full, which causing in the next page, only some of the rows outside group will be displayed (e.g. * END OF RECORDS *).
Then, in the report header, the Customer ID field cannot get the value of ReportItem!CustomerID which leave it blank.
Is there anyway to solve the blank issue? Or make the row outside group must attach to the tablix details in the same page? For some reason, I cannot limit the number of rows display per page. Thanks.

Maybe you can try throwing in another hidden copy of the final "Customer ID" somewhere on the "END OF RECORDS" group row and then use an IIF to call that one if the original hidden "Customer ID" you have isn't present on the final page.

You can control when the page breaks occur and keep the elements together, but it's not very intuitive. First, don't use actual Headers and Footers. Just use textboxes that will appear at the beginning and end of each Customer's data. Second, you need to wrap everything in a grouped rectangle. This will be grouped by customer with page breaks set to happen between instances.
See my answer here for more details on how to do this.

If I was going to display "Body" object values in the report header, I would create a hidden expression text object somewhere in the "Body" that uses a Code call ( Report Properties, Code ) to put the value into a shared variable. Then, that gives you a set variable, get variable, type of situation. The variable is updated as the "Body" object appears throughout the report, and the variable 'sticks' across pages where the object does not necessarily occur.

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.

SSRS Total by Type

I am new to SSRS. I have a report that goes like this
Type Amount
A 500
B 200
A 100
C 400
C 200
I want to convert this to a report like this
Type Total Amount
A 600
B 200
C 600
Basically get distinct Types on the left column and th totals for those types in the right column. Is there a way i can do that easily?
Thanks
Starting with you simple report which just lists the records in your DataSet:
Design:
Results:
Right click on (Details)in the Row Groups section and choose Add Group -> Parent Group:
Choose the field you want to group by (Type in our example) from the Group by: dropdown, choose to add either a group header or footer and click OK:
Your table will now look something like this:
You can delete the second column and the third row - or second row if you chose to add a group footer earlier - entirely (clicking OK when deleting the row and being prompted to delete the associated group), leaving a layout like this:
Now just click the field selector for the empty cell in the table and choose your Amount field:
or right click on the empty cell, choose Expression from the context menu and enter the following expression:
=Sum(Fields!Amount.Value)
either of which should result in the formula being placed into the cell:
Now run your report and you should get the expected result:
There's loads of places online with similar guides and resources which you can also consult:
MSDN Reporting Services Tutorial (Adding Grouping and Totals)
MS TechNet (Calculating Totals and Other Aggregates)
MSDN (Add a Total to a Group or Tablix Data Region)
There are also several other similar questions here on SO which you'll find if you just search for them.

Show column from database in report footer of SSRS

Is it possible to show data from database in SSRS footer?
I tried but the only option present is to show first record from dataset. But I want to show all records (I just need to show one column) one by one on each page.
Is it possible?
Based on your comment I believe this link Display on Page Footer is what you are looking for.
I tried this and it works on Page Footer.
One way to do this is by making your report a list of subreports.
Make a new report with a List item and a dataset that gets a set of all the departments you are going to get. Consider this to be your "List" report.
Populate the list with the dataset. Put a page break between List item members.
Make another report (or modify your existing one so) that is designed to be a single-page report about a single department, so #department will be one of the parameters. It contains all the data you want on each page of your report, including the footer with the Department name, which it gets from the department parameter, so it doesn't need to get it from a dataset. Consider this your "Base" report.
Going back to your List report, put a sub-report in your List item, point the sub-report to your Base report, and populate the department parameter with the value from the dataset that is populating the List.
Yes, it is possible using the "Lookup" aggregate function.
Assume, your report has a dataset named "Department_DataSet" which contains all the department's data plus one additional column e.g. PageNum, that contains an integer sequence starting from 1, giving you, basically, a sequence of the report page numbers:
PageNum | DepartmentName | Address | etc.
--------+------------------+------------+-----
1 | Department 1 | ... | ...
2 | Department 2 | ... | ...
...
N | Department N | ... | ...
Now, add a Textbox into the footer and assign the following expression to it:
=Lookup(Globals!PageNumber, Fields!PageNum.Value, Fields!DepartmentName.Value, "Department_DataSet")
and it will show the department name as required, but please ensure that the page numbers go in the same order as the departments in your detail report.

Creating multiple-page reports in Access (new page for each group)

I'm looking to create a report which is specifically designed to be over multiple pages, based on one condition. The condition is that when the grouped item (call it invoice) changes, it starts a new page, instead of putting all the data on as little pages as possible.
At the moment it runs like this,
Invoice, Date, ID
------------------
2 , Now , 1
------------------
3 , Now , 1
------------------
I want to insert a page break between the invoice numbers, but can't figure how to do it, is it possible?
In the Group Header for "Invoice" on your report you can set the Force New Page property to Before Section to start each invoice on a new page. For details, see
Print each group of your Access report on a separate page

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.