I have a query that returns the following fields:
GrantCode
EmplID
EmployeeFullName
AssignedUnit
DaysOff
HourlyRate
CalendarEventStart
CalendarEventEnd
NumberOfHours
StatuteNumber
ViolationDescription
I want to have a stepped SSRS report that shows:
the calendar start time, end time and number of hours under the employee name info and then another grouping that shows the citations that were issued during the time period. I can't quite figure out how to get the SSRS groups set up to display in this manner.
I currently have all the data in a single query/data set but can separate it if that will make the reporting easier.
Any suggestions?
Thanks!
Leslie
Add a tablix to your report. Put in the tablix the fields Citation Number, Statue Number, Violation Description, Number of Citations. Then go to Row Groups > Add Group > Parent Group chose for group by the EmplID and check the Add group header, then hit OK.
Afterwards click on the most left column in your tablix and chose Insert Column > Inside Group - Right. Do this a few times and put in these colums the fields EmployeeFullName, Assigned Unit, HourlyRate, DaysOff, StartTime, EndTime.
Then go to your Row Groups and click on the drop down by (Details) and chose Group Properties > Visibilty and check Display can be toggled by this report item:. Here you have to chose the name of the textbox where the EmplID field is. Now the detail data get toggled by the EmplID.
If you want other data to display just add another column and put your fields or expressions in this column. A new column before the two dotted lines is on the group level and column after the two dotted lines are for the detail section.
Related
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.
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.
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.
Requirements are as follows:
Grouping hierarchies should be swappable, for example Country > City > Department and Country > Department > City can be selected by the end user.
For the end user, there should be only one report.
The hierarchy that the user wants can be selected in a parameter value.
The data for the report should only be loaded once, since the query contains cpu intensive calculations.
I'm trying to do this by adding subreports for each hierarchy. Since hidden subreports are automatically loaded, I cannot toggle visibility of multiple subreports, or the data will be loaded twice. The ReportName property of the Subreport does not allow expressions. Can I use custom code to solve this, or what is a viable solution?
There are quite a few ways to do this.
If your dataset is embedded in your report, then I think the simplest way is:
Add your parameter, let's call it GroupingOrder, and hardcode your options: say set the Value to 1 for label of Country > City > Department and value of 2 for Country > Department > City
Add two calculated fields to your dataset within SSRS. (Right click on the dataset name and select "Add Calculated Field...". Name one "MiddleGroupName" and the other "InnerGroupName." Set the Field Source to formulas such as this for MiddleGroupName:
=IIF(Parameters!GroupingOrder.Value = 1, Fields!City.Value, Fields!Department.Value)
Use these calculated fields as normal groups in your report.
For bonus points, set the column titles based on your parameter: the column title for the middle group could be:
=IIF(Parameters!GroupingOrder.Value = 1, "City", "Department")
Another method could involve moving these calculations into the Grouping logic itself.
But I would steer clear of subreports in this case. They tend to hurt performance and create debugging difficulty.
I have an SSRS report
where the date should be grouped by project category
the project code in the category is repeating in side the group how do I suppress the value
Please help me to get an idea.
Thanks,brijit
You can also hide fields by putting an expression in the Hidden property like this:
=Fields!ProductCode.Value = Previous(Fields!ProductCode.Value)
So if the value in the previous record is the same as this one, it will hide the field. You must sort the dataset correctly for this to work. In your case I think the sorting would be Date, ProductCategory, ProductCode.
In the past I used this often together with expressions for field borders to group the output visually.
I think there is one option hide duplicates in properties in ssrs. so you will check in that option under the project category group.so that you can hide the duplicate values and get unique records. first u create one group based on project category in fields properties and then check in that hide duplicate option under that group.whenever you check in that option it will high light one drop down list showing containing group or dataset there you select your created group.
This is a bit late for you brijt, but what I do is edit the textbox properties for that field, in the font tab enter an expression for Color as follows:
=IIf(Fields!ProductCode.Value = Previous(Fields!ProductCode.Value), "White", "Black")
...assuming your background is white this will effectively do what you want.
I think it may be an issue concerning the way you are grouping the dates. Do you have the grouped with time on them as well but suppressing the hours in your output?
For example:
12-5-2010 12:00:00
12-5-2010 13:00:00
if you strip the times off in how you see them but not how you group them, they would show up duped.