Dynamically sized charts in SSRS 2008R2 - reporting-services

I'm stuck on an issue where I want my bar chart to grow vertically based on the number of groups display in my graph.
I have a shared dataset looking at a SharePoint list then I have a dataset
in my report referencing this but applying some filters based on date ranges. I've then set that as the dataset for my graph which works neatly but there's a widely varying number of potential grouping categories to be displayed. I was looking at this article here which is a neat way to do it, but I don't want a manually set parameter, I just want it to grow based on whatever shows up. One thought I had was in the DynamicHeight expression was to check the number of "CategoryGroups" that show up but I can't see a way of getting to the chart object in the VB expression editor.
I saw an example of doing group by in SQL in the dataset editor but I don't get that option looking at a SharePoint list. Is there a way in DynamicHeight expression editor to reference report objects?

Similar to the article, you can use a distinct count of the group items in a expression in order to dynamically size your chart.
The expression could look like:
= (2 + CountDistinct(Fields!item.Value, "DataSet1")) & ” cm”
Which is (minimum size + size for each group item) in cm (or any unit you prefer)

Related

Microsoft Report Builder: How to display selected chosen values from a multi-value parameter in a table?

I'm using MS Report Builder v3.0 to create a report. As part of this report, I have a multi-valued parameter (named #Diagnoses). The labels and some of the values (truncated by the size of the display boxes) of this parameter are shown below:
What I would like to be able to do is display the labels / values the user chooses in a 2-column tablix (I've tried using separate textboxes for the labels / values but the results are mis-aligned).
However, this does not appear to be straightforward. The closest method I've found is this one, which stores the user's choices in an internal parameter in xml format, then queries this parameter to produce a dataset from the xml.
So, I created the xml-producing internal parameter like this:
...and I've created a dataset based on this data, with the following query:
But now when I put these values into a tablix, the labels and values are now on separate rows, like this:
Does anyone have a straightforward way of sorting this out?
Best Wishes
C J
OK - I've solved it (it's not pretty, but it works!)
Basically, the problem comes from having to use the join statement when creating the xml - you can't really put both the label information and the value information on the same row in the xml.
To get round this, you have to use two internal parameters to create two datasets - one for the labels column, one for the values column. The method for creating these is essentially the same as that shown above, except for the values parameter, the expression for the default value is:
...and for the labels parameter, it's this:
(by the way, make sure you set the available values to "None" for internal / hidden parameters - the expressions here are for the default values)
Then, when you create the values dataset, you use the following syntax in its query:
...and similarly for the labels dataset.
Finally, in the report, you create one matrix from each of the two datasets, then put them next to each other, using fixed row heights and setting "can shrink" / "can grow" to false so that they look like they're in the same table:
I hope this helps somebody!

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.

I'm getting a #Type! error when using operators in Access report (Access 2010)

I'll do my best to describe my problem. I'm modifying a report in Access 2010. I have a text box in my detail section that displays the weight of a pallet with boxes on it.
=[PalletWeight].
The PalletWeight field is generated from a SQL query that grabs this information from our database. As it so happens in the database that field appears like so:
100.000000000. I don't know the data type for that field in the database because looking isn't as simple as opening SQL Server, but =CDbl([PalletWeight]) does work so unless someone tells me they need to know I didn't obtain that information for this question.
The pallets are grouped by item. So item 1 might need to be carried on 3 pallets, item 2 might need 4, etc...
As mentioned earlier, I used CDbl on the textbox to convert the value to appear as 100.00 on the actual report.
I need to add a text box that calculates percentage. For each item, the total weight of the pallets needed per item is a certain percentage of the grand total weight of all pallets produced.
When I attempted do something like the following I get the #Type! error.
=Format([PalletWeight / Sum(PalletWeight) * 100, "Percentage")
I've also tried to refer to the text box by name (name reference) to perform operations on its value instead of the value contained in the text box.
=Format([TextBox1] / [Textbox2] * 100), "Percentage").
This report has various grouping sections. I've tried using hidden text boxes to hold the values I want to manipulate and referencing those but it seems as soon as I use arithmetic I get the #type!.
I'm using the expression builder in the properties Control Source section. Any help would be greatly appreciated.
You either need to modify your query to add another calculated field
say dblPalletWeight =CDbl([PalletWeight])
and then use that in your formula
=Format(dblPalletWeight / Sum(dblPalletWeight) * 100, "Percentage")
Or modify your formula to do the conversion on the fly
=Format(CDbl([PalletWeight]) / Sum(CDbl([PalletWeight])) * 100, "Percentage")

How to Display Only 1 Value Label in SSRS 2012 Calculated/Derived Series?

I have been using SSRS 2012 (Sql Server Reporting Services) with SQL Server Report Builder 3.0 (11.0.2100.60) to create Column charts that display columns for each day/week/month and display a trend line based on the mean across all days/weeks/months.
However, although the calculated series reflects only 1 value (the mean across all days/weeks/months), value labels appear on the chart displaying the single mean value for each day/week/month - that is, 3 days will result in 3 value labels for the same mean value.
Is there a way to force the series to show only 1 value for each mean trend line?
See below for sample chart.
The work-around I ultimately settled on involved creating duplicate series with value labels but invisible data points (obtained by setting Color to "No Color").
The values for this series are only assigned if the "dayofweek" field matches the first "dayofweek" field in the dataset, so only 1 data label will be displayed (namely, the first one).
For example, to show a single value for the average of the "physio" field for physiological alarms within my dataset ("techphysDayofWeek", I use the following formula):
=IIF(Fields!dayofweek.Value = First(Fields!dayofweek.Value,
"techphysDayofWeek"),Format(( Avg(Fields!physio.Value, "techphysDayofWeek") /
Parameters!StartDate.Value), "##.#"), "")
I wish SSRS provided an easier way, but after struggling with this seemingly simple issue for hours on end, I'm just glad to have any fix!
You can set the label text to be based on a formula. In that formula you could look at the value of the grouping field, and set the text to an empty string if it's not currently the group you want to have the label on.

Conditional background color in line charts

I am currently trying to convert our charts over from PQ Systems Chartrunner to SSRS 2008 charts. I am currently working with a line chart in SSRS 2008 and am trying to get the background color to change for the different sigmas. I am able to calculate and chart the standard deviation sigma lines, but I have not been able to change the color of the background between the lines.
What I have so far in SSRS:
In the Chartrunner chart, the Red/Yellow/Green zones:
Is there a way to do this in SSRS 2008?
Yes, you need to look at using Strip Lines in your report:
Highlight data by adding Strip Lines.
This is a decent link, too:
Axis Strip Lines in SSRS.
Because you can make these expression based, the bands can be determined at run time. It should work in your case as you always have a set number of bands, just different values when you run the report.
Here's a simple example, based off the following dataset:
Most important thing to note is that I've included the limit rows max, mid, and min in the dataset; these makes the Strip Lines easier to create.
Create a simple chart:
Select the Y Chart Axis and expand the StripLines collection:
You can see that I've set IntervalOffset and StripWidth, based on the fields in my dataset. End result:
So you can see it's possible to do this dynamically as required. It's a simplified example but the concept is readily transferable; you should be able to adapt it to your requirements.