SSRS Reset Page Number on Tablix Group not working - reporting-services

I have a tablix (named TX_Order) associated to a dataset (named AccOrderDS) with the following columns:
Order Date
Order Amount
Order Quantity
Account Number (Hidden)
Account Address (Hidden and join from another dataset by using the LookUp function)
The tablix is grouped by the Account Number and Page break on "Between each instance of a group". This part works fine.
Now I need to add a page number on the Report Header and the page number should be reset when the group (Account Number) changed.
So I set the PageName for this tablix as:
=First(Fields!ACCOUNT_NUMBER.Value, "AccOrderDS")
and on the Report Header, I add the [&PageNumber] textbox
However, the page number was not being reset. It keeps increasing even the group (Account Number) changed. I googled and used the method mentioned in https://blogs.msdn.microsoft.com/robertbruckner/2010/04/25/report-design-reset-page-number-on-group/ but the page number still not reset.
Did anyone encounter this issue before? How to fix it? Any help would be highly appreciated. Thanks!

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.

Average of calculated field in Access subform

I am working in Access 2007 with a subform that shows the Mass of a determined set of records linked to a master form.
The form is displayed in spreadsheet view and has two columns [Mass] and [Include]. Include is a True/False field to select whether the record is to be included in the final calculation.
In the footer of the subform, I want to add the average of the masses of the records where [Include] = True.
So far I have created a new field [MassIF] = IIf([Include]=True,[Mass],Null), this works correctly in the spreadsheet.
However, the =Avg([MassIF]) control in the footer gives an error, any idea why that would be and how to get around the issue?
Also, =Avg([Mass]) works fine until I add to the footer the =Avg([MassIF]) control, then I get #ERROR in both fields, which looks really odd to me.
Try calculation in textbox in footer:
=Avg(IIf([Include], [Mass], Null))

SSRS rows in tablix outside group goes to next page

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.

SSRS. Hide a Column based on Row Group Value

My application uses SSRS to produce payslips for employees. The Payslip report consists of a tablix with 5 columns. Among the 5, is a column called "Units" and another called "Invoice value".
The report has several Row Grouping levels, but the only important one for this question is the Payslip Number Row Grouping "RG_SlipNum". There is a page break after each "RG_SlipNum" RowGroup.
When users want to print Payslips, they can optionally supply up to 5 parameters which filter the result set to print out.
Employees can be paid based on the number of units delivered * a rate (Unit Based), or by a percentage of the invoice value (Invoice based) for the delivery (Oversimplified, but hopefully, you get my drift).
If the employee is Unit based I want the Units Column to Show, and the "Invoice Value" Column to be hidden. If they are Invoice based I want both columns to show.
My dataset has a bit field indicating whether to show or hide a column based on the logic above. It will be a 1 or a 0 for every underlying row within the current rowGroup. I have tried to use the First(,) function in a Column Visibility expression on the "Invoice Value" Column. However, I get the following error whenever I try to limit the scope of the First Function to the current Payslip Rowgroup using the RowGroup name.
"The Hidden expression for the tablix 'X' has a scope parameter that is not valid for an aggregate function. The scope parameter must be set to a string constant that is equal to either the name of a containing group, the name of a containing data region, or the name of a dataset. "
So, my Question(s)
Can you define a RowGroup name as the Scope argument in a First() function?
If not, What's the best way of achieving this without completely re-working my Dataset / RDL to accomplish this. (Using SSRS2008)
Why is it always just after posting a forum question, you figure it (or some workaround) out?
I'd still like some (better) answers if anyone sees this, but I've set a cell in the tablix to the value of the bit field that determines whether to show the column or not. I then changed my Column Visibility expression to check the cell value (using ReportItems!textboxname.Value) and it's working. as I scroll the payslips the columns visibility changes appropriately.

SSRS Page break on Tablix with Rownumber ,just one row group and no group expression given by default

I have created a report with one tablix and it has one RowGroup (which automatically came) when I dragged and dropped my report fields. [It doesnot have any group by expression defined]
Now my requirement is to create page breaks based on the row number.
I clicked on the RowGroup properties and give Group on expression
=Floor(RowNumber(Nothing)-1/2000)
And page break "Between each instance of group "
Now page is breaking,but the problem is its breaking for every row in my tablix.
How can I overcome the same and break only at 2000 rows.
This is to avoid Excel export exception on large data.
What am I doing wrong with the tablix/group settings.
I haven't done this before but try adding another group outside you current group with this expression. Then set the page break in it.
Edit: I just re read you question. I think you expression is incorrect. I think it should be:
=Floor((RowNumber(Nothing)-1)/2000)
I couldn't understand how you could set that as the group expression and it would stil group correctly. So you will still need 2 groups:
An outside group with this expression and the pagebreak.
A details group with what you are actual displaying on each row.