23

I have a row in a tablex that I want to hide based on a condition. I can do this with the visibility property and also using CanShrink as well is an option.

I've tried both of these and the best I can do is hide the row (make it invisible), but it keeps the whitespace it takes up - I need to remove the whitespace too so if it is not shown that it doesn't take up paper/viewing space.

I have also made the height of the row very small and put cangrow=true so that that if i populate the field with data based on an expression it will grow to the right size but this is not ideal because there is still 0.03125in of space for the row that is always shown (minimim height) and if it grows it grows to fit the text but not neccessarily the set size I want.

I thought I had done this before in an older version of RS but I can't seem to get it to work correctly in this version (2008).

Any ideas?

Dan
  • 905
  • 4
  • 10
  • 16

5 Answers5

37

Try to set the Hidden property of the Static Row Group under the Details Group, in this case the whole row will disappear instead of the content of the textboxes.

If you are using Report Builder, you need to switch to Advanced Mode (make sure that the Properties and the Grouping windows are displayed, go to the upper right side of the Grouping window and press the black triangle):

The magic triangle

Click on the second "Static" item under the "(Details)" group and you can set the Hidden property on the Properties window.

Link to MSDN sample

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
retupmoCyuG
  • 387
  • 3
  • 3
  • 2
    You must also switch to Advanced Mode as described above in the report designer in Visual Studio 2015 (rdlc). This worked for me. Selecting the tablix row and creating an Expression for the Hidden property worked, but left the whitespace for the hidden row as described in original post. This is an easy, albeit somewhat hidden (difficult to discover) solution. I would have never clicked the little downward pointing triangle. I thought It was for accessing options for Column Groups. – iCode Nov 09 '15 at 19:12
  • 3
    This doesnt seem to work. I have set the row visibilty and the white space remains. I also tried setting HideIfNoRows, also didnt help. – greg May 30 '17 at 14:56
  • For me setting `HideIfNoRows` to `True` for the row in question *did* work – Leif Jones Dec 30 '22 at 17:27
  • This answer saved a lot of work and frustration. I tried to hide the row from table, but the trick was to set the row Hidden property back to default -> False, and do what retupmoCyug suggested and it just worked as it should. The rows are hidden and there is no whitespace. It was a nightmare for me. Thank you very much for the solution! – Robert Tab Mar 21 '23 at 11:59
5

A simpler way to get to this option for hiding a row is to right-click on the row header and select "Row Visibility". From there you will get a dialog where to can enter an expression.

Rono
  • 3,171
  • 2
  • 33
  • 58
  • 9
    As I described in my comment, and as mentioned in the original post, this does work in that it hides the row, but it also leaves whitespace for the height of the row, which would be undesirable most of the time. – iCode Nov 09 '15 at 19:16
1

I was able to make the rows go away by setting the following 2 properties

textbox.CanShrink row.Hidden I played w/ row.HideIfNoRows and it seems to have no effect in accomplishing the desired outcome described by op.

Click on textbox, these one is in the properties of the textbox (if there are multiple columns, I assume you will have to make this setting for each cell/textbox, in my case, I only had 1 column)

CanShrink=false

For the next property, you have to go into ADVANCED MODE by clicking the down arrow at the right side of the Row Groups/Column Groups pane.

Click on the Row containing the line you would like to hide. The Hidden property can be found in properties pane... This is an alternate way to set Hidden, as opposed to right clicking the Row Header in the actual Tablix.

Hidden= <expression describing when you want the row hidden hidden>

One other note - If you right click the Row Header and choose 'Row Visibility' you get a dialgue. the Row Property dialog has a caption "Show or Hide Based on an expression".

The actual behaviour is It will HIDE the row if the expression evaluates to TRUE. IMHO - this is misleading, at best ambiguous.

Once you understand the property you are actually setting is called HIDDEN, then this makes sense. Until then, I certainly assumed I was setting a property called Visisble... FWIW....

greg
  • 1,673
  • 1
  • 17
  • 30
0

On the empty row you want to hide, go to the text box properties and go to expressions -> visibility, then show or hide based on an expression and use

=iif(first(Fields!.Value = ""),true,false)

bob
  • 1
  • 1
  • the field value is on the empty text box you want to use to hide the rest of the rows – bob Feb 10 '17 at 18:20
0

Setting row visibility logic is important, but I've learned that sometimes a blank row will still appear, even though its contents are hidden. To solve this, I had to do the following non-intuitive steps, but I did in fact succeed in completely suppressing unwanted white space.

  1. In the cell in the tablix region, use the Insert > Rectangle menu option.
  2. In the rectangle, use the Insert > Textbox menu option. Resize as needed.
  3. In the textbox, right-click and enter a placeholder.
  4. Set the value of the placeholder expression to whatever you need.