Report items affecting each others positions in SSRS 2008
Asked Answered
D

4

16

I'm having trouble with some report items changing other items' positions when they are conditionally hidden.

I've been using Reporting Services 2000 for printing item price labels as PDFs, with the report consisting of a single table with a single cell for each item. The data fields and other items on the label are all placed inside a single rectangle. Because of the very specific layout required, some of the report items overlap in the designer in order to position correctly on the rendered PDF.

This has worked fine for several years, until we upgraded to SSRS 2008 and I had to migrate the report to the new version.

Now, suddenly, when certain items on the report are hidden (by an expression in the Hidden-property), certain other items shift their positions. In some cases, even the containing rectangle is resized.

After quite a bit of googling, I've come to the understanding that SSRS 2008 attempts to maintain the relative spacing between report items, so that if an item to the left of another one changes in size, the item to the right is adjusted accordingly.

Apparently, hiding an item equates to changing its size to zero, and so the item next to it is shifted left to fill the gap.

However, I do not want this behavior, since all items should stay in their predefined positions regardless of others.

So, does anyone know of a way to "fix" report item positions, so that they are not affected by hiding other items?

I've tried placing the items inside separate rectangles so as to group them, in the hope that only items inside the same rectangle can affect each other, but this does not seem to help.

Any ideas would be greatly appreciated.

Dermis answered 6/4, 2011 at 11:44 Comment(0)
F
14

In the side by side example, you can place the control that may be hidden into a rectangle big enough to hold both; but then put the other control that must stay in a fixed position BEHIND the rectangle (i.e. the parent of this control is the report rather than the rectangle).

If that's not enough, and the hidden and non-hidden items use the same dataset, you could (shudder) use a giant tablix control with a grouping of =1 and the right number of rows and columns to control the layout (because you can insert rectangles inside).

Some other tricks are to set the color/backgroundcolor properties to white (though in some rendering formats you can click and drag to highlight and still read what was there)... alternately you can go so far as to make the contents of controls all expression based, so as not to produce anything if a condition is met, and so it's basically invisible.

Fluorescein answered 13/4, 2011 at 15:0 Comment(3)
Oh my god, that actually worked! I had tried all of that, except for setting the z-index of the containment rectangle in front of the affected fields! Huge thanks man, you saved my day! I wish SSRS had some property to disable this "dynamic layout" feature, but for now, this solves my problems without too much hassle.Dermis
I have the same issue on 2012. I found more detailed solution here: dinesql.blogspot.com/2010/05/…Wirra
It's so crazy, it worked! Gotta love SSRS! I actually only placed the textbox that would get hidden into a rectangle slightly wider than itself so that the rectangle would be it's parent and as you suggested, sent the rectangle to the front.Salamone
C
1

Another approach: create rectangles containing the fields you want to hide, then put a WHITE line across the entire bottom (or top) of the rectangle. This keeps the rectangle the same size even if the fields within it are hidden. A rectangle will shrink if the fields within it shrink, but the line spanning the entire rectangle prevents this from happening.

Charlatanism answered 9/1, 2018 at 19:6 Comment(0)
H
0

Not sure if this will help anyone else as it's a fairly specific requirement but it solved my variant of the OPs issue so here goes. I was designing an SSRS report to print labels (in my case the Avery 5164) and the users wanted to pick which labels on the sheet they would print because they may have already used one or two labels from a page. Because the positioning of the printed labels is important I needed them to stay in place even if the labels above them on the sheet were hidden. My solution was to create empty rectangles of the same size as the label and lay them directly on top of the existing rectangles. Even if I hide two, three, four, etc... labels, the rest will stay put.

Hindrance answered 6/12, 2018 at 4:0 Comment(0)
P
0

Just draw a Rectangle, and slightly overlay the Objects with the Conditional Hidden expression with the position of your new empty Rectangle. Objects out to the right will be held in place by the Rectangle. No background colors or anything, just a Rectangle. Works vertically like if you have an address block and you want objects underneath the address lines to stay put. Like so... enter image description here

Permute answered 21/10, 2020 at 18:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.