How to display group by(department) value outside the table in ssrs? - reporting-services

I am working on ssrs can someone tell me How to display group by(department) value outside the table in ssrs when page break is set on groups ?
Actually i want to show the department name on top of S.no,Computer etc row which is set to Repeat on new Page:
in image i want to display PROJECT MANAGEMENT on top of table and that name should be changed accordingly(department vice) when navigate to next page.

Make sure the department name is in your table somewhere, you can hide it if you don't want to see it in the output. Make a note of the TextBox name by looking at it's properties (let's say it's called DeptName)
Then in the page header, add a textbox and set it's expression to reference the textbox in the main part of the report using it's name (in our case DeptName) like this.
=ReportItems!DeptName.Value

try something like this
Insert your table in List component then set list GROUP BY "Project Management" Column
Set Tablix Use GROUP BY "Project Management" Column
See image below
But I'm not sure Project Management column are repeat on other page
Hope it Help.

Related

Textbox label not updating on page change

I am creating a report using SSRS which contains pages separated by individual account holders. Each page represents one account and I am using a textbox label in the header to display the name of the account; however, I am having trouble getting the textbox label to show different name as I navigate through pages.
So for example, on page 1 the account label in the header would show Account A, and on page 2 it should show Account B. However, right now it always shows Account A regardless of the page it is on. The expression of the label looks like this : =(Fields!Account_Name.Value)
Do I need to create a grouping or some sort in order to have the account change depending on the grouping of account name? If so how do I go about doing this? Thanks!
You will have to display the group field in the page header.
The expression would be something like this:
=ReportItems!Account_Name.Value
Reference: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/1bc58a64-db73-4eda-9f86-21d6f9e23c84/ssrs-to-display-page-header-as-per-the-group?forum=sqlreportingservices

First of Function in SSRS / show first row of each page

In my SSRS report, I have more than 500 pages. In the header section, I have used an textbox with expression First (Productname), where the productname is one of the column in my report.
How to display the First row productname of each page on that control? Now it will always display the first row productname of first page on all the pages.
You need to use the ReportItems collection. Get the name of the cell that contains the text you want by clicking it and looking at the properties, assuming the name is myColumnCell then the expression in you header cell would be
=First(ReportItems!myColumnCell.Value)
Look here for more details if required.
https://learn.microsoft.com/en-us/sql/reporting-services/report-design/built-in-collections-reportitems-collection-references-report-builder

SSRS - Changing tab name when exporting to excel

I have tabbed my report in SSRS 2012 by having my page breaks based upon grouping classname and it works great. How do I change the tab names when exporting to Excel? I tried having an expression for page name =Fields!classname.Value. In doing so, it makes all 4 of my tabs equal the first page break of Sales Division.
My tabs are based upon the grouping of classname, which in returns gives me the 4 tabs: Sales Division, VRS, ClearCaptions, and IP-relay.
You need to set the PageName of the Tablix Member (group), NOT the PageName of the Tablix itselfs.
If you got the right object, if will say "Tablix Member" (Tablix-Element in German) in the title box of the properties grid. If it's the wrong object, it will say only "table/tablix" (without member).
Also, be advised to set the sort order of the group expression, so the tabs are alphabetically sorted.
If you get the tablix instead of the tablix member, it will put the same tab name in every tab, followed by a (tabNum). That is exactly your current problem.
This solution was not working for me.
I had to add group break page.
https://www.mssqltips.com/sqlservertip/3527/export-sql-server-reporting-services-report-data-into-multiple-excel-worksheets/

Only allowing one Drilldown in SSRS

It took me hours of searching and putting together piecemeal parts to find the solution to this, so I figured I'd post it on here in the hopes of helping someone else.
The Problem: We need to display a report, with proper grouping and drilldowns. However, we should only allow one group to be drilled down at one time.
SSRS doesn't exactly have robust scripting options - for instance, you can't close other groups "on click" or anything like that. So how do you do it?
In My example i'm using the AdventureworksDW database. I want to have a dataset that includes the total sales for each group and region. My Stored Procedure looks something like this:
SELECT dst.SalesTerritoryGroup,
dst.SalesTerritoryRegion,
SUM(fis.SalesAmount) AS SaleTotal,
DATEPART(YEAR,fis.OrderDate) AS OrderYear
FROM [dbo].FactInternetSales AS fis
INNER JOIN [dbo].DimSalesTerritory AS dst
ON fis.SalesTerritoryKey = dst.SalesTerritoryKey
WHERE fis.OrderDate < #QueryEndDate
GROUP BY
dst.SalesTerritoryGroup,
dst.SalesTerritoryRegion,
DATEPART(YEAR,fis.OrderDate)
UNION ALL /*The ResellerSales table. Same info.*/
From there I added a table with two groups: SalesTerritoryRegion and its parent, SalesTerritoryGroup. I also added a column to the left INSIDE the SalesTerritoryGroup, with an X (this can also be an image if you'd like). This is the "Drilldown" button that we'll use.
Create a string parameter, mine was #ExpandedGroup. Set the Default to an empty string (so that all the groups start out collapsed). Right click on the SalesTerritoryRegion group, or whatever your subgroup is, and go to the visibility tab. Click "Show or Hide based on Expression" and enter something like this:
=iif(Parameters!ExpandedGroup.Value="" or
Fields!SalesTerritoryGroup.Value<>Parameters!ExpandedGroup.Value,True,False)
This statement means: If we haven't opened a dropdown, or if the dropdown isn't the one selected, set hidden to true. Otherwise, false.
Next click on your "X" column to the left of SalesTerritoryGroup or your supergroup. Right click to go to Textbox Properties. Click the action tab. From there select "Go to Report". When you specify a report, make the target itself (For instance, mine is Main). Then, add parameters to the report.
The most important here is ExpandedGroup. The name should be ExpandedGroup, but the value is not just [ExpandedGroup]. Instead, it's an expression:
=IIF(Fields!SalesTerritoryGroup.Value=Parameters!ExpandedGroup.Value,
"",
Fields!SalesTerritoryGroup.Value)
This expression says: If the Group is the same as the Expanded group, make ExpandedGroup an empty string when you load the report. Otherwise, send the TerritoryGroup value. Essentially, this will let us toggle on and off the drilldown (same as you would in the report if you had traditional drilldowns).
Note: Also be sure to pass other parameters! For instance, my query requires a date to exclude some transaction data. If you don't pass this parameter in the "Go to Report" action, then you'll have to enter it again when you DrillDown. This also means you can give yourself even more flexibility when you click a drilldown (changing a chart that's displayed etc.) which is what I'm doing for this project.
Hope it helps someone out! Of course, if there is a more elegant or simpler solution I'd absolutely love to hear it.

Reporting Services - Group Name in Page Header

I have a report with one group (Office Name) which page breaks between each group - so the data for only one Office can appear on a given page. How do I get that Office Name to appear in the page header?
I tried creating a hidden textbox in the details section of the report which has the Office Name value and then referencing that in the Page Header, but I get the last Office Name value on page 1 and then it is blank on every other page.
Today, at last I found another way to do this.
On the group that you specified the page break, in the properties window, expand the Group section.
See Pagination in Reporting Services (Report Builder and SSRS)
You can set the BreakLocation property in the Tablix Properties,
Rectangle Properties, or Group Properties dialog boxes, but you must
set the Disabled, ResetPageNumber, and PageName properties in the
Report Builder Properties pane.
You should see a PageName field. This field can be set to that of one of the field data values from the dataset used by the tablix.
Once you have set the PageName field, you can add a textbox to the Page Header/Footer and set the expression to use the PageName field. Built-in Globals and Users References (Report Builder and SSRS)
=Globals!PageName
This should then change on each group change, and be visible on each page.
I have realy struggled finding a good solution for this, so if I need to clear up the answer, please feel free to suggest this.
I got it to work and I'll post the answer in case someone else runs across this issue.
For some reason referencing the text box did not work, but when I put a hidden column in the table with the same value, I could then reference that in the Page Header.
I am actually doing this in the footer and it worked! Thanks! Just wanted to add if you have multiple values you are trying to display in the header or footer, you can string them together with a delimiter in the pagename expression like
=Fields!FIELD1.Value + "|" + Fields!FIELD2.Value + "|" + Fields!FIELD3.Value + "|" + Fields!FIELD4.Value
Then you can create new fields (one for each value) and parse out each field like
=(Split(Globals!PageName, "|")).GetValue(0)
=(Split(Globals!PageName, "|")).GetValue(1)
=(Split(Globals!PageName, "|")).GetValue(2)
=(Split(Globals!PageName, "|")).GetValue(3)