Changing properties for multiple fields at once in SSRS Designer - reporting-services

This is very similar to the post on Formatting multiple fields at once in RDL, but there are still issues with setting properties like Size.Width and Font.FontSize when the underlying data is different between selected cells.
Here's the accepted answer:
Select all the controls in the designer and press F4 for properties. Change the background color
But if falls short when there is a property that is made up of several child properties. Here's an example using font and size, each of which are comprised of several properties.
This is what it looks like when a single field is selected or when multiple fields are selected that all have the same value:
But if I highlight several cells that have different font sizes, or widths, I lose the ability to edit them all simultaneously. For example if I wanted to make consistent column widths across an entire report.
Here's what the properties look like when multiple fields are selected and any of them have a different value:
It's not ideal, but in the case of the size property, I can enter the shorthand value which includes both width and height separated by a comma and it will apply that change to all the selected cells.
But for some reason, in the Font section, I can't even do that.
Other things I've tried:
Using the Formatting Toolbar - which seems to be always greyed out for SSRS:
Using the Formatting Menu Item - which doesn't expose the FontSize property:
Using the Context Menu to enter the Properties Form, which is disabled:

They will be greyed out if they are not identical in all fields selected. This can depend on a related formatting field being different.
One workaround is to create an internal text parameter:
With default value of the value you want to use for the property:
Then set the property for each cell that should have the same formatting to this parameter individually:
Repeat this for each of the relevant child properties, you will then be able to change formatting across the report by changing the parameters.

Related

Using the Can Shrink option for Currency

I am creating a report in Microsoft Access 2019.
Using the code: =IIf(Trim(Nz([TextBox],""))="","","TextBox"), I have been able to use the can shrink option to save space, and make the report easier to read. Using this and similar codes, I have been able to shrink text boxes, dates, and check boxes.
I am having trouble with currency though. Since the currency boxes are already filled as $0.00, I can't use the code above.
When I tried these two codes: =IIf(Trim(Nz([Base Cost],"$0.00"))="","","Base Cost") or =IIf(Trim(Nz([Base Cost],""))="$0.00","","Base Cost") I got an error saying "The control has a reference to itself"
Along the same lines, how would I code the unbound box label for the Currency if I want it to shrink.
In Essence: I have two boxes: Base Cost and $0.00. I'm having trouble figuring out an If/Then statement for the currency to display ONLY if it has value greater than 0. Then how would I code the Base Cost label to display ONLY if the currency if greater than 0.
Thanks.
I got an error saying "The control has a reference to itself"
warns you, that the control (textbox) has the same name as the bound field (if you use add existing fields, they are named equal) what only is valid, if control is directly bound to the field.
You should always rename those controls, to prevent side-effects (like the circular-reference).
Empty controls can be made invible, instead of shrinking. To format by condition, use conditional.formatting (no visible property, but setting background and textcolor to to forms color hides too).
To check for= ""as condition only catches empty fields. Check the unformated value!
Trim(Nz([Base Cost],""))="$0.00"
can't get true, as[Base Cost]is empty or 0. It just displays $0.00, because of formatting!
Nz([Base Cost],0)) > 0
Sets[Base Cost]to zero if empty and then compares if greater zero.

How would you dynamically hide or display a SSRS header based on a parameter?

I need to hide or display the header of a SSRS report based on the value of a parameter. The parameter is called "Show Header?", and the values of this parameter are true and false. Is there a hide property for headers? If so, I'm not able to find it.
I'm not sure if you are talking about the table Headers or the report header (some people seem to use the term interchangeably).
I'm still self learning SSRS so there may be better options out there but a quick test i found the following.
For a Boolean Parameter type:
I used the logic below to hide the visibility based on parameter (you may want to play around with the true/false order depending on your parameter to get it to work how you want):
=IIF(Parameters!ShowHeader.Value, False,True)
Table Headers:
Just highlight the text boxes you want to show/hide and open up the properties, under Visibility select "Show or Hide Based on Expression"
(NB. i found highlighting the full row would only let you select the full tablix properties not the single row so I just shift clicked all the cells and pasted the IIF statement into the "Hidden" Property for the selection in the properties window)
Report Headers:
I am not sure you can hide the Header (couldn't see any immediate hiding properties or options), however you could hide the contents of the header using the same sort of process (right click properties and alter the Visibility setting or add the code into the Hidden property). In testing I found that the header would reduce to remove white space when items where hidden so may work out for you.
The sneaky way I've found to get around the limitation of SSRS on this is to put my "header" in the first row of the first tablix and just hiding the actual report header, which you probably know cannot be deleted. That way, I can show or hide the first row of the tablix by whatever criteria I desire. This method works well for me.

Hide multiple rows or columns in SSRS report with same Expression at same time

I have a report containing a Tablix/table with sets of rows and columns which I am hiding conditionally using Expressions, via the Column/Row Visibility dialog.
If for example I have 3 columns which I want to all have the same Expression to determine their visibility, is there any way for me to achieve this without opening the Column Visibility dialog for each Column and entering the appropriate Expression?
I've tried selecting multiple columns, but then the right-click context menu no longer offers the Column Visibility option (it's greyed out) and I have also tried out the Hidden property of the columns (which can be amended in bulk by selecting multiple columns), but this only stops the columns from being rendered, leaving a blank space where they used to be (rather than how Column Visibility works, where columns to the right of the hidden columns are moved across to fill the gap, like hiding columns in an Excel sheet).
Is it possible to achieve what I'm after, or will I have to continue opening the Column/Row Visibility dialog for each column/row I wish to conditionally hide/show?
If the columns you want to control the visibility for are next to each other, you can create a Column Group for them and manage the visibility via the Group.
Add a new column group at the appropriate level so that only the relevant columns will be included.
If you already have Column Groups this will likely be a Child Group or an Adjacent Group.
If not, you can create an initial Column Group by dragging a Dataset field from the Report Data into the Groups pane.
Insert new columns inside the new group, and move the data from your existing relevant columns into the group.
The new group does not need to repeat, so in it's properties window set Group on: to a plain text value, e.g. "1".
Input the desired visibility settings into the Visibility page of the properties window.
For each of the individual columns inside the group set the Hidden property to False, to remove any other expressions or settings that might interfere.
Not exactly what you are looking for but perhaps a midway point - and this can apply to many things other than visibility (e.g. background colour, tooltip) - edit the RDL directly using View Code. This has the added benefit of being able to implement changes that are almost identical per column instead of identical with a minimum of mouse usage.
Typically I have set one column up the way I like it in the designer and then copy/paste under the other columns. In the case of visibility look for <TablixColumnHierarchy><TablixMemebers>. You will see a list of empty <TablixMember /> items along with the expanded <TablixMember><Visibility><Hidden>=... block where you have set up one column. Simply copy paste that block over the empty items at the position of interest (you will need to count it out unfortunately as there are no identifiers).
Bonus Tip: If you make a mistake or want to change something later, you can do a replace on all expressions at once (optional regex allowed).
Remember to backup or check in your work first because the designer may not open that report again correctly if you make a mistake :-)
Select the columns you want to conditionally hide and press F4 to see the Properties Window. Look for the Visibility node and use the Hidden property to set the conditionally expression.
The expression should evaluate to True for hiding and False for showing.
Let me know if this helps.

Labels in fields within an SSRS report

I am attempting to reproduce a form within SSRS and fill it with data. The original form has blocks with small labels inside of each box that identifies the entry requested.
I "thought" I could simply use two different tablixes: one for the blocks with borders and labels, and the other one with the actual datafields or expressions, and align the 2nd tablix directly over the first one so that it appears as though the fields are presenting data inside of the labeled boxes.
It looked as I wanted it in design view, but when I went to preview the report, it pushed the 2nd tablix below the first tablix, in effect creating two tablixes, one stacked on top of the other one (not displaying as how I intended).
So, how do I accomplish the form design in the manner that I am seeking?
You should be using a type other than tablix for your report. Use a 'List' instead and you can free float objects as you need them and also nest a tablix as well. A little explanation on list:
You can float images with text boxes and then even change syntax or draw boxes around them and decorate those.
The call out for a field in SSRS is [(value)] with the [] meaning: "Data Column in recognized Dataset"
You can call out Variables with an '#' in front of them [#Test] would be a variable a user would put in called 'Test'.
Whatever size 'List' element is will determine how large it is when it repeats. If you want a strict form ensure the length and width are set correctly on the properties of that element.
If you want it to break every page you can click on the 'List' > Right Click the top left corner > Properties > 'Add a page break before' checkbox.
My example shows a super simple textbox with a dataset that only has three ideas repeat as many times as there are id's, three times. You can apply this to your form as needed.
It looks like you could reproduce that form header quite easily with a single tablix. If you envisage the form as a set of tablix cells like so:
then all you need to do is set the Border properties for each cell to hide the borders as needed (or you could merge the cells e.g those for Applicant and Location).
You can use a tablix with only Header rows, deleting the detail row. If you need multiple forms per report, then put the tablix inside a List region.

In SSRS how to conditionally change the colour of a datalabel font on a chart when it appears on the bar

I have created a bar chart that shows values on data labels.
The Data label is placed outside the bar
But in some cases the label appears on the bar where the bar is too long.
In this scenario I would like to conditionally change the font/colour of the data label so that it's more visible.
However I can't see a way to dynamically determine where the label has been placed.
What I can think of is this. You can change the background/font color of all those series labels who's value lies in the range of 95%-100% of the maximum "Value". To be exactly precise as to what should be the threshold to change the bg/font color seems a daunting task, but you could play around with test data.
For writing the expression to change the font color,I would first change the dataset and add a column on the lines of PercOfMax. This column can be calculated easily in the dataset by using basic aggregate functions.
Then you need to go to the Chart Series Label properties-->Color and write the expression on the lines of -
=IIF(Fields!PercOfMax.Value>=95, "YELLOW", "BLACK")
As I said, you might need to do some more research to finalize the value of this threshold(which I am assuming to be 95).
Another solution to this problem is to use fill colour of the label and set its background to a bright colour (e.g. colour), and leave the font colour of the label black. Thus you can always see the label, and there is no difference when it's outside of the bar.