SSRS Color Expression Not Working When Deployed - reporting-services

In SSRS 2016 I have a matrix that is using a recursive parent hierarchy and have the following expression outside of the column groups, this textbox is the referenced for the Color property to set the text White or Black:
=IIF(Level() = 0 And Fields!HasChildren.Value, "White", "Black")
This works perfectly fine using the preview in SQL Server Data Tools but when viewing the deployed report in report manager when this expression is true the row group text box has black text and not white, yet the column group text boxes have white text as expected.
If I export the report into Excel, Word, PDF, MHTML when the expression is true all text is white. This appears to a problem with the ReportViewer and it is the same in IE11 and Chrome 68.0.3440.84
Putting the expression directly on the textbox does not fix the issue, I have found that if I put the actual expression within the same textbox as a placeholder the property is set correctly.
Any suggestions on how to resolve this?
Expected:
Actual:

I had this problem too. Not sure if I can nail it down specifically, but what I did was looked at the canGrow and canShrink properties of every cell on the row, and make sure they are all the set the same way. In my case, both were set to true. Once I did that, the coloring rendered correctly on screen in SSRS.
Looked here because I had a very different problem that I was banging my head against the wall for where the problem wound up being settings for this field being different for cells in the same row.

I found the expression based foreground colour property doesn't propagate past the first column to any cell that has canGrow false. canShrink has no effect. Other cell properties don't show this problem.
Thanks liver.larson.

I believe this patch from Microsoft fixes the problem properly:
[https://support.microsoft.com/en-au/help/4338240/kb4338240-fix-toggle-item-font-color-and-background-color-expressions][1]
If your organisation won't let you deploy this patch, a workaround is to make the cell contents into an HTML placeholder, then use <font> and <b> etc. tags (possibly generated conditionally) to control the formatting of the cell. If the cell has numerical information in it, change the text box format to General and use the format() function in the cell's value expression to convert the value to text (the format string can be whatever it was in the Properties window for the cell)

Related

SSRS - Indicator and value in same cell?

I have created a Directional indicator (Green up arrow and Red down arrow) in my SSRS report, referring to the value of the column next to it. This all works ok:
However, I really want the indicator and the value to be in the same cell, like Excel can:
A Google found the following article , where the last post suggest it is possible using the following syntax:
=Format(Fields!Column1.Value, "Format") + " " + "Indicator"
I assume "Indicator" refers to the name I gave to my Direction indicator, but I can't get it to work..
I have read that by using border formatting I can get my two cells to look like one, but I would ideally like it all to be in one.
Any thoughts appreciated!
Mark
I would do this by placing a Rectangle inside of the cell and place your indicator along with another text box inside the rectangle. The downside to this is (depending on how you align the items in the rectangle) the formatting may cause split cells in excel exports.
Ross's method will work and there are alternatives..
The article you referenced was a text indicator not an image (from what I could tell).
You could do something similar by simply adding a a placeholder in the cell (right-click inside the cell and click "create placeholder"). You can then set the font and colour independently from the rest of the cell.
You could use a common font such as wingdings to get arrows and then the value and color properties would be expressions to show the correct 'character' (arrow) and the correct colour.

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.

SSRS get rid of last page

I have a ssrs report with multiple rectangles.
Each rectangle has "add page break after" property checked. Each rectangle may or may not be visible based on certain conditions.
I want to get rid of the last blank page in the report.
I already set the ConsumeContainerWhitespace to true.
I can't think of another way to get each rectangle on different page and yet having no extra page.
Components that have the PageBreak property also have the Disabled sub-property. The result must be either True or False. When set to True, the page break will not occur. So what you would need to do is concatenate the other components' visibility conditions into one big condition in the Disabled property of the page break. Here's what it looks like in the RDL file (my example will always prevent the page break) :
<PageBreak>
<BreakLocation>End</BreakLocation>
<Disabled>=IIF(1=1, True, False)</Disabled>
</PageBreak>

SSRS hide white space from empty textbox outside of tablix

I'm new to both SSRS and development in general, and can't seem to find the answer to my problem. The report itself is simple-- a stored procedure collects responses and I display them using Lookup expressions in textboxes. Some fields are not required, so some of the textboxes are empty in my report. I would like to remove the white space left by the empty textbox.
In retrospect, I wish I had used a table to format the page, but since I have a very large number textboxes with expressions, I can't easily refactor my work. I found solutions for tablixes (Trying to Get Rid of White Space in SSRS Report), but nothing for free-standing text boxes.
Is this possible?
If you right click on the textbox and navigate to 'Textbox Properties...' you can toggle the visibility of the textbox, and if it is hidden you wont see the white box. You could also enter expressions, like the one below for example will hide the textbox if there is no data in it.
=iif(isnothing(reportitems!Textbox1.Value),false,true)

First Textbox in Tablix cell defeats CanGrow of other Textboxes if it spans page break

I'm having a problem with the way SSRS handles long text in Textboxes inside a Tablix when the first Textbox is broken by a page break. Here's the simplified setup:
Create a Tablix with a single cell.
Add a Rectangle to that cell.
Add 2 Textboxes to that Rectangle, one below the other.
Ensure CanGrow = True for both Textboxes.
Add data to each Textbox such that each one contains multiple lines and the first contains enough lines to force some of it's lines past the end of the page. It helps to set the Page height to something ridiculous like 1 inch for testing purposes.
It's necessary to preview the report in Print Layout mode or export it to PDF to see that all the lines in the first Textbox print, but the second Textbox only prints the first line. Taking enough lines out of the first Textbox to avoid splitting it across a page will allow the second Textbox to print all of its lines.
Am I missing something? Is there a way to get the Tablix to behave properly across page breaks? It's the Tablix because moving the Rectangle and Textboxes outside of the Tablix fixes the problem. I don't see a CanGrow or similar property on the Rectangle or Tablix. A workaround is to put each Textbox into its own Tablix row, but that's not ideal in my situation.
I was able to reproduce the problem, but looks like there is an easy workaround:
If you nest a second rectangle in the first, and then nest the second text box within that rectangle, my pdf came out correctly. I tried this with BIDS 2008R2, 11x8.5 (landscape) pages.