Left align columns with fixed width in SSRS 2008 column chart - reporting-services

I hope this is a simple question, but I have been beating my head against the wall for hours now. I would like to create a column chart in SSRS 2008 with columns that are always the same width and always the same width of space between columns. The catch is that the chart will not always have the same amount of columns.
Here is what I have in scenario 1 with 12 columns:
Here is what I have in scenario 2 with 4 columns:
I would like to see something more like scenario 3 instead:
As of now this is a very simple column chart. The only real modification I have done that I feel will be important to mention is that I have set the PixelPointWidth value to 20 in the Chart Series -> Custom Attributes section. This ensures that the columns all stay the same size. I notice that the PointWidth value in the same section is used to control spacing between columns, but it does so by making the columns larger/smaller to fit. The PointWidth value has no effect when the PixelPointWidth value is greater than zero.
Please help me find the way to keep the columns the same width and also maintain the same width between columns!

Manipulate your Dataset so that it always provides rows for Value 01 through to Value 12, with null values for the measure. Then in the Chart's Category Group properties, use an Iif function for the Label property to set it to an empty string "" if the measure is null (or use another column as a flag).

Related

SSRS - hide a column and change width of other column

I'm creating a report that has 5 columns. However, one column can have no data and in that case I need to hide it. This works using the 'Hidden' property of column but when the column is hidden, I want to make the first column wider. Is there any way to do this in expression?
The only solution I found is to have multiple same tablixes with different column count and then show or hide each tablix appropriately if the specific column has no data. (by checking 'Max' value in column).
Unfortunately, it's not possible to enter an expression to the column width property but if you simply need to change the width of one other column when the first is hidden, I've come up with a workaround that works fairly well.
The idea is a little easier and requires less data to load than your current solution. Basically, you'll create an identical width column that is simply empty -- but set the borders to appear as if it is simply part of another column. So you'll simple reverse the expression used to hide the column with no data in the hidden property. To achieve this, depending on where you choose to add the extra space column, you'll have to adjust the borders of the adjoining cells where there is no right border on the cell to the left and a left border on the cell to the right. Depending on your layout, you would only need a top and bottom border on the extra space column cells.
I did something similar with a report that has 3 pages and 11 columns -- but 8 of the columns changed from page to page. I had to hide one column, show another, and used expressions in column headers and detail rows to simply change the data in each column based on a field that returns the type of the data.

SSRS - Shrink report width when hiding columns

Using SSRS 2013. I am able to hide columns with boolean values, but the report (body) width does not shrink when columns are hidden. Thus, there is excess blank/white space to the right of the report. Is it possible to eliminate this excess space? If yes, kindly will you please advise how?
The report body width - as with any column width and unlike heights - is a set value that cannot be changed on execution. You need to either put up with the white space, format your presentation layer to not be affected by the appearance of the white space or redesign your report so the objective of hiding the columns can be achieved in a different way.
I ran into this exact same limitation of SSRS. I was able to achieve what I believe you are trying to get (consistent report and report col width when certain columns are hidden due to parameter vals, etc.)- by simply having 2, separately formatted report tablix/tables in the report and hiding/showing based on a parameter (or some SSRS-expressible logic):
1 for the condition when all columns are present; 1 for the condition when some columns are omitted- both of them formatted to utilize all available screen real estate to minimize white space and make things look "clean".
Instead of hiding column(s) when my hidden condition is true- I simply show the 2nd tablix and hide the 1st. And when the filter changes to show all columns, I do the reverse (hide the 2nd tablix and make the 1st visible again).
Not sure if that helps, but I figured I should share if it might aid anybody else facing this issue.
PS: Your tablix Hidden expressions will look something like this:
[the full column tablix].Hidden
=iif(Parameters!parmOmitSomeCols.Value = true, false, true)
[the tablix with some columns omitted].Hidden
=iif(Parameters!parmOmitSomeCols.Value = false, true, false)

Dynamic Width Adjustment of a Column in Tablix in SSRS

Hi everyone,
I wanted to adjust the width of a tablix column dynamically. can some one please let me know how can this be done? when i searched some forums there was a suggestion that i try creating an instance of the report in the CODE of the report properties and access the tablix column using the instance but i wasn't able to do that. Can some one please help if indeed i can try creating an instance of the report and access the tablix and adjust the width dynamically ?
Thanks,
AJ
On the off-chance that anybody is still looking for a way to have dynamic column widths in SSRS (as I was), I've found way that works for most scenarios.
Basically you add another column header to your table/matrix/tablix and set your column to your minimum required width, then add a subreport to the new header. The subreport consists of a matrix with a static row group and a dynamic column group that generates a number of fixed-size columns based on the desired width, which is passed via a parameter from the main report to the subreport.
e.g. Your main report has a column where you want to set the width from data or a parameter, which is in a range from 5 to 10cm, with increments of 1cm. Let's say for a particular column you pass down 7cm to the subreport, which then does a basic SQL loop to produce some data with 7 rows. The matrix column grouping in the subreport points to that data, which produces 7 columns, each 1cm, for a total width of 7cm (plus the row grouping which is shrunk as much as possible). The main report's column then expands to the size of the subreport, which is 7cm.
Select the first column, in properties, find the width property (under size) add an expression that uses the same condition for hiding column 3 and increasing the width of the first column, e.g.
=iif(parameters!par.value=true,"1,5cm","2,5cm")
--EDITED --
I'm very sorry my previous solution was false, I hadn't checked it, I'm sorry to have wasted your time, but I have a solution that works.
create two first columns, i.e. two columns that show the same information, one that is the width that you like when column 3 is visible (lets call that one col1a) and one that is the width that is suitable to when column 3 is hidden (col1b) and then make those two alternate. then when you hide column 3 then you also hide col1a and make col1b visible and then the other way around
There is no property to auto size the column width. Length we can do it dynamically. That is the limitation Microsoft tools.
For now, one solution is to have a reasonable fixed column width (such, as 30) and set the textbox CanGrow to True so it wraps to next line if needed. Another solution is to have two columns and hide one of them conditionally.

How to increase Chart size dynamically inside a table in ssrs

I have a range bar chart inside a table of row group and the chart is repeatedly generated according to a category. I want to increase chart height dynamically based on a category.
suppose
if category =A THEN CHART HEIGHT=10CM
if category =B THEN CHART HEIGHT=7CM
If you look in the Properties of the chart there is a field called DynamicHeight, which will, as suggested, dynamically change the height of the chart based on a value.
For example I have set a parameter called Offset to default to 8.
You can then set the value of DynamicHeight to
=CStr(Parameters!Offset.Value) + "cm"
Then, as you change the Offset parameter, the width of the chart changes.
DynamicHeight = 8
and
DynamicHeight = 4
Now how you calculate the height to be a meaningful and consistent is up to you... I get the impression you wouldn't want to use a parameter like the example above, but I'm sure it would be possible to create a calculation that will give you a sensible layout.
Update
Note it is not possible to alter the DynamicHeight on a table that is recreated multiple times in a Matrix.
I believe this is because the size of the chart area is determined to generate the layout of the report, and this area is then populated with the actual chart later in the rendering process. It doesn't know until the later stage that is should be a smaller size, so therefore is not the smaller size.

SSRS - How to continue data to next column?

I need to report "Employee Name" And "Age", but I do not need to continue the names to the next page; I need to continue it to the next column.
It should look like this :
_________________________________________________
| Employee Name | Age | Employee Name | Age |
|_______________|_____|_______________|_________|
Can anyone send an report that manages this? I am using Microsoft report service.
You want a multi-column report by the sound of it.
On the Layout tab, right-click somewhere where there aren't any report objects and choose Properties. Click on the Layout tab and set the number of columns to how many columns you want on the page - in your example it would be 2. This will give you a column to lay out report objects on the left and a greyed-out column on the right that will be where your column on the left will repeat.
However, there are a couple of tricks here:
Your columns must fit on the page or you won't get any columns. For example, if your Layout settings are at their default of 1cm spacing and 2.5cm left and right margins, then your column must be less than 7.5cm on an A4 (21cm wide) page. Otherwise you will only get one column as two columns don't fit on the page.
The report renderer in your designer doesn't support multiple columns so you will only see one column in the designer. The HTML renderer also doesn't support multiple columns and you will only see one column for the report when deployed to the reporting services server and displayed as a web page. You need to output your report to a renderer that supports multiple columns, such as PDF or a printer, in order to actually see columns in a multi-column report.
Update - faking multi-column report using tables
Failing that, to get it to display the way you want independent of renderer is to use a hack with two tables, like you tried, but the trick is to hide the rows in an alternating manner.
To implement this hack, create two tables side by side that both point to your data set. On the Detail row of the first table, for the Visibility-Hidden property use the following formula:
=iif((RowNumber(Nothing) Mod 2) = 0, True, False)
On the Detail row of the second table, for the Visibility-Hidden property use the opposite formula:
=iif((RowNumber(Nothing) Mod 2) = 1, True, False)
This means the first table will print every odd row and the second table will print every even row, effectively giving you multiple column output.
For a generic solution for visibility of the tables when wanting more than two columns, use the formula:
=iif((RowNumber(Nothing) Mod TOTALCOLUMNS) = THISCOLUMN, True, False)
where:
TOTALCOLUMNS is the total number of columns
THISCOLUMN is the column number this table represents, zero-based (i.e. first column is 0, second is 1, etc)
For example, the table for the third column in a five column output has the Visibility-Hidden property set to:
=iif((RowNumber(Nothing) Mod 5) = 2, True, False)
Note that this is slightly different output than true multiple column as it reads left-to-right rather than down the page before wrapping to the right hand column as true multi-column does. However, it has the advantage of rendering properly in every renderer.
You could adapt this method to do true multi-column by working out how many rows you can fit on the page from the InteractiveSize-Height property and displaying that many columns in the left table then the rest in the right table and so on throughout the report but this might be fragile depending on renderer and changing page layout settings like margins. The method above is simple and effective.
I am trying to do EmployeeName and EmployeeTitle. I tried to implement Chris' solution above. I would get the expected values in each table but they would be duplicated.
I did a little bit more research and I ended up with the following for row visibility.
For Even rows I used:
=iif(RunningValue(Fields!jobtitle.Value, CountDistinct, "EmployeesDataSet") Mod 2 = 0, True, False)
For Even odd rowsI used:
=iif(RunningValue(Fields!jobtitle.Value, CountDistinct, "EmployeesDataSet") Mod 2 = 1, True, False)
The rowgroup was on jobtitle.
Source: RowNumber for group in SSRS 2005