Hiding a table in SSRS - reporting-services

I currently in between the development of a report. I have set of tables that needs to be hidden incase if values are not present.
As seen in the image, the second set of table should be hidden when there is no data in it. It shows the data obtained from the second row of the table.
=IIF(LOOKUP(2,Fields!RowNo.Value,Fields!SeqNo1.Value,"dsContractReceivablePerc")=0,TRUE,FALSE)
This was the condition that I gave for hiding the table.
But after deployment when I viewed my report, I found that even though my table was getting hidden, there was a large empty space left in its space.
Could anyone help me out here? Am I missing anything?

To remove the blank space, you can add a rectangle containing the 2 tables.
Then if the table is not visible, it will adjust the size accordingly.
The Report Design: Best Practices and Guidelines contains an interesting section called "Useful Tips for Report Design".
This page was published in 2005 but is still applicable.
Using Rectangles to Keep Objects Together
Rectangles in Reporting Services can be used either as graphical
elements or as containers of objects. As object containers, they keep
objects together on a page and control how object move and push each
other.
To keep multiple objects together on a page, put the objects within a
rectangle. You can then put a page break before or after the rectangle
by using the PageBreakAtStart or PageBreakAtEnd properties for the
rectangle. Using Rectangles to Control Item Growth and Displacement
Items within a rectangle become peers of each other and are governed
by the rules of how peer items are positioned on the page as they move
or grow. For example:
Items will push or displace each other within the rectangle.
Items will not push or displace items outside the rectangle, because they are not their peers.
If necessary, a rectangle will grow to accommodate the items it contains.
You can use this logic to your advantage when dealing with objects
that expand. For example:
If you want to leave a blank space in your report for a table to expand into, group the blank space and the table in the same
rectangle. When the table grows, it will push the blank space.
If you want to prevent a matrix from pushing items off the right edge of the page, put the matrix within a rectangle with blank space
to its right. Now, the matrix is no longer a peer to the other item on
the page and will not be able to push it until the matrix can no
longer be contained within its rectangle.

Related

Tablix pushing other elements down

I have a report with a tablix in it. I just need to stay the tablix in a fixed position and shouldn't push down other elements down it. If say there are 4 rows which will be visible in the specified space and if more then it should not be visible and shouldn't push down other elements.
I tried several ways to prevent
Added tablix inside a rectangle(act as a container) so if it grouped it
will not push down other elements (didn't work)
Enable consume white space in report=true (didn't work)
Keep items together property is set to true in rectangle (didn't work)
Is there any other way to not to pushdown elements in the report even if the tablix gives more rows. It should only show the rows in the mentioned size.
Edit : 1 (7/28/2018)
All the three elements below is pushed down if the table has more rows.
Either I have to fit the rows in this table by reducing the size automatically if possible or It should not push down the elements.
Also if the tablix has less row the elements will move up. I just need to keep the elements (Expr) should stay in the same position.
You still didn't post your design but anyway, here is what I think you want.
The basic idea to to set the area you want you table to cover by using a rectangle of the same size. Then we will reduce the row heights within reason as the number of rows in the table increases. As you cannot directly change a row height, we can get round this by setting the row height to be very small and adjusting the font, as long as the can grow option is on the cells will grow to fit the font size, giving the effect of changing the row height.
Basic steps.
Create your report and add a rectangle that is the maximum size you want your table to be. In my example it's 38mm high.
Create a table inside the rectangle. I find this easier to create it outside then cut and paste it inside, simply dragging it over the rectangle will not work.
Position your additional text boxes, under the rectangle as desired. Set 'Consume Container WhiteSpace' on in the report properties.
Next we need to decide what the maximum and minimum font sizes are that acceptable. In this basic example I only use 3 sizes, 10pt, 12pt and 14pt. If you want to use more then you could write an expression to scale the fonts more accurately but you get the idea.
You'll need to determine the maximum number of rows you can fit into the rectangle when the minimum font size is used, in my case it's 5 rows at 10pt font. Your query will need to take this number into account and never return more rows than this.
On the table, the click row selector for the detail row (this basically selects all the cells in the row). Next, change the font size property to an expression. In this simple example I used this.
=SWITCH(
Parameters!topx.Value <3 , "14pt",
Parameters!topx.Value <5 , "12pt",
True, "10pt"
)
Next set the row height, choose any cell on the row and set the height to something small, I used 4mm but it doesn't matter as long as its' smaller then you will ever show.
In my example, for testing I added a 'topx' parameter and filtered the dataset using this, but this is only for testing.
The final design looked like this. I added a background colour to the rectangle so you can see how it remains static until it's filled.
Then running with various rows looks like this
finally, only if I exceed my maximum (5 rows in this case) does the text below move down.
You could include a column (let's call it RowNumber) in your dataset that shows the row number of the data. Then in your Tablix filter, you can set the filter to show only values from that "RowNumber" column that are less than or equal to the number of rows you want to display in the tablix.
You can use the same concept to limit the number of rows returned in your query, but without knowing how you are getting the data, it is not possible to help with that.
If you want your report to be that static, why not take a screenshot of the data and include that as an image in your report?
No serious reporting tool will "ignore" records that you pass to it using a Dataset, so that's the place where you will have to "ignore" all unwanted data yourself. Restrict the data in the Dataset to only 4 rows (maybe using SELECT TOP 4 ...).

SSRS How to match rectangle peer heights to avoid spacing issues in Word exports?

Quick Summary
I have an issue that only occurs when exporting my SSRS report to a Word document (something clients have requested). In short, when rectangle is shorter than its peer, Word inserts a page break even if there is plenty of whitespace left to render the longer column all on one page. I would like to resolve this so that Word takes advantage of the entire page when the peers are of different heights.
Layout
The highest level of the layout consists of three rectangles, as shown below:
The left and right rectangles are of fixed widths, but variable heights.
There is no extra space at the bottom of the Parent Rectangle; it expands based on the contents of the other two.
Each rectangle several other items and uses multiple datasets.
There are rectangles inside the rectangles, which group some of the child objects together.
Some of the controls are textboxes. I don't know the length of the text at design time.
Word Export Result
There is enough empty space above the footer to hold the entire left column, with excess.
If I open the document and manually enter empty lines into the right-hand column to increase its height, items from the left-hand column which have a height equal to or less than those line breaks will float back up to the first page. This is what makes me believe Word is cutting off at the shortest of the two peers.
Things I've Tried
Another thread suggested putting the columns into a table instead of rectangles, to force them to expand together. However, it required that they use the same dataset, which they do not.
Looked for CanGrow or ConsumeContainerWhiteSpace type options that could apply to rectangles, but couldn't find any. ConsumeContainerWhiteSpace is set to true on the report itself but makes no difference.
Attempted to create a function to dynamically set the inner rectangles' height, or the height/padding of a hidden textbox, based on the longer peer. Unfortunately, there doesn't seem to be anything for fetching the height at runtime; the functions I found all rely on knowing static data such as the number of rows (of a fixed height) in the sheet, but each column has several fields of which the height is unknown prior to loading data.
Extended the height of each rectangle to that of a full page by default and tried to find a way to make the elements inside consume this empty space as needed. The space was never consumed, and always pushed down, resulting in an extra page of whitespace.
Question
Is there any way to notify Word to use its available whitespace rather than cutting off at the shortest peer? I've been looking for a long while and keep coming up empty-handed.
Thank you!
How about instead of using a rectangle, you use a List with two columns?
I think the list will do better with pagination than the rectangle. YMMV - Not sure how it exports to WORD.
Put your left rectangle in the first column and the right rectangle in the second column.
Use the same data set and Group on 1 (the number) so there's just one row.
Had the same issue. I managed to make it work by adding a horizontal line that take the whole width of the main rectangle just below the two child rectangles

How do I stop tables inside a list from expanding the list

I have a List that contains a Table. The List is sized sufficiently that the table should be able to fit 10ish rows, which is more data than should ever come out in that table so that should be fine.
My problem is that as rows are generated in the Table, it causes the List to resize as if it needed to grow to accomodate the rows. I thought that the ConsumeContainerWhiteSpace property was intended to prevent this behaviour however that setting does not make a difference.
Here's an example (cropped to avoid some data appearing); as you can see the left hand List, which is the only one in which the Table contains some data, has expanded vertically even though there is plenty of room for the table within the list.
How do I prevent this?
Put your list in a second rectangle. Setup the rectangle to show its border. That way you have a border with a constant size from the rectangle.
Create a rectangle
Setup rectangle border to appear
Create a list that populates based on your data
Drag and drop the list into the rectangle
Note that I did notice that the rectangle will grow in size if the list has enough elements to expand beyond the rectangle border. This shouldn't be an issue in your case, but it could impact someone else.

Place a logo at rdlc report so that it can update its position dynamically at the top of last column

I am working at a rdlc report and i want to Place a logo at the right most corner of the last column.
I placed it at fixed position at the top of last column. but when in a case a column hides in between than last column moves toward left but logo will remain at the same place and it creates a logo formatting issue.
please suggest an appropriate solution.
You have fallen foul of the inability of Reporting services to dynamically alter the location of items. It is not possible for you to automatically align this logo - without embedding it as part of a table. There are two ways around this problem.
Option 1
Add a new header row to your table. Merge the cells together. Insert a rectangle into it, and insert your logo on to this, as shown
The downside of this is when you hide a column, the last column expands to fill the new whitespace.
Option 2
Add a new header row to your table. Insert a rectangle into the furthest right column, and insert your logo on to this, as shown.
Notice how the logo moves with the columns
(4 columns visible)
(3 columns visible)
The downside of this however is that your final column must be the width of the logo, and must never be hidden, otherwise the logo will disappear.
Summary
These are the only workarounds I can think of. Hopefully one is suitable for you. As mentioned at the top SSRS really doesn't like dynamic layouting of objects!

Formatting Issues in MS Access Report - The Height property does not change with the CanShink and CanGrow property

In an MS Access Report, I have text-boxes with the CanShrink and CanGrow property set to true. A procedure runs when the form is opened, dynamically adding data to these text boxes. I retrieve the Height property from these text-boxes after data is added but it appears that it is retrieving the original height of the text-box (the height that it was created as in design view).
Is there any way around this? I am essentially trying to create a table like structure, where the height of the and number of cells are unknown until run-time. Should tables really be so difficult to make?
Here is a visual of my problem:
Note:
Form msdn: "When a control shrinks, the controls below it move up the page." That hasn't been the case in my project, though when a control grows, the controls below it move down. The main problem is that bottom border of the adjacent cell does not line up when a cell grows.
The size of the Left boxes are preventing the Right boxes from moving up.