SSRS - How to continue data to next column? - reporting-services

I need to report "Employee Name" And "Age", but I do not need to continue the names to the next page; I need to continue it to the next column.
It should look like this :
_________________________________________________
| Employee Name | Age | Employee Name | Age |
|_______________|_____|_______________|_________|
Can anyone send an report that manages this? I am using Microsoft report service.

You want a multi-column report by the sound of it.
On the Layout tab, right-click somewhere where there aren't any report objects and choose Properties. Click on the Layout tab and set the number of columns to how many columns you want on the page - in your example it would be 2. This will give you a column to lay out report objects on the left and a greyed-out column on the right that will be where your column on the left will repeat.
However, there are a couple of tricks here:
Your columns must fit on the page or you won't get any columns. For example, if your Layout settings are at their default of 1cm spacing and 2.5cm left and right margins, then your column must be less than 7.5cm on an A4 (21cm wide) page. Otherwise you will only get one column as two columns don't fit on the page.
The report renderer in your designer doesn't support multiple columns so you will only see one column in the designer. The HTML renderer also doesn't support multiple columns and you will only see one column for the report when deployed to the reporting services server and displayed as a web page. You need to output your report to a renderer that supports multiple columns, such as PDF or a printer, in order to actually see columns in a multi-column report.
Update - faking multi-column report using tables
Failing that, to get it to display the way you want independent of renderer is to use a hack with two tables, like you tried, but the trick is to hide the rows in an alternating manner.
To implement this hack, create two tables side by side that both point to your data set. On the Detail row of the first table, for the Visibility-Hidden property use the following formula:
=iif((RowNumber(Nothing) Mod 2) = 0, True, False)
On the Detail row of the second table, for the Visibility-Hidden property use the opposite formula:
=iif((RowNumber(Nothing) Mod 2) = 1, True, False)
This means the first table will print every odd row and the second table will print every even row, effectively giving you multiple column output.
For a generic solution for visibility of the tables when wanting more than two columns, use the formula:
=iif((RowNumber(Nothing) Mod TOTALCOLUMNS) = THISCOLUMN, True, False)
where:
TOTALCOLUMNS is the total number of columns
THISCOLUMN is the column number this table represents, zero-based (i.e. first column is 0, second is 1, etc)
For example, the table for the third column in a five column output has the Visibility-Hidden property set to:
=iif((RowNumber(Nothing) Mod 5) = 2, True, False)
Note that this is slightly different output than true multiple column as it reads left-to-right rather than down the page before wrapping to the right hand column as true multi-column does. However, it has the advantage of rendering properly in every renderer.
You could adapt this method to do true multi-column by working out how many rows you can fit on the page from the InteractiveSize-Height property and displaying that many columns in the left table then the rest in the right table and so on throughout the report but this might be fragile depending on renderer and changing page layout settings like margins. The method above is simple and effective.

I am trying to do EmployeeName and EmployeeTitle. I tried to implement Chris' solution above. I would get the expected values in each table but they would be duplicated.
I did a little bit more research and I ended up with the following for row visibility.
For Even rows I used:
=iif(RunningValue(Fields!jobtitle.Value, CountDistinct, "EmployeesDataSet") Mod 2 = 0, True, False)
For Even odd rowsI used:
=iif(RunningValue(Fields!jobtitle.Value, CountDistinct, "EmployeesDataSet") Mod 2 = 1, True, False)
The rowgroup was on jobtitle.
Source: RowNumber for group in SSRS 2005

Related

Avery labels printing PDF 2 columns across then down

I have followed this documentation http://www.bscichicago.com/documents/CreatingAvery5160MailingLabelsSSRS.pdf
to print my labels but I did not see where they Spreading Data across 2 columns. PDF rendering is just printing in first column and at the end of the page it will now begin the second column. I wish to print in one column then next column before going to the second row in PDF rendering. Thanks
Create two identical tables side by side that both point to your data set. On the Detail row of the first table, for the Visibility-Hidden property use the following formula:
=iif((RowNumber(Nothing) Mod 2) = 0, True, False)
On the Detail row of the second table, for the Visibility-Hidden property use the formula:
=iif((RowNumber(Nothing) Mod 2) = 1, True, False)
This means the first table will print every odd row and the second table will print every even row, effectively giving you multiple column output but left-to-right first, then down the page, rather than down the page first before moving to the next column like SSRS multi-column reports do.

Hiding nested tables not working, showing A LOT of white space SSRS

So, I have a report in SSRS that contains 5 tables nested in each other all with 2 columns. We have working expressions for every table in "show and hide based on an expression" on textbox visibility, but instead of hiding the chosen tables it shows a lot of white space in the supposedly occupied area. We have been trying to reduce the white space but with minimal success. We hide the tables based on parameter values, example below:
Parameters!prmName.Value=false
=IIF(Parameters!prmName.Value= true, IIF(Parameters!prmText.Value=true, False, True), True)
The second one is for the second column which one also can hide if that parameter is chosen to be hidden.
The expressions look almost the same except some parameter names and so on.
There is 1 parameter for every table aka 5 which we use when hiding each of them.
We have tried using this in row visibility IIF(Trim(ReportItems!Name.Value) = "", true, false), but as we said it did not work.
We have also tried visibility on the tables' groups unsuccessfully.
--------------EDIT---------------
So each table is representing a kind of level. Like the first, and most outer table is a letter and the second outer table is an undergroup of the first table and so on:
A
01
011
0111
01110
01111
012
0121
01210
B
05
051
0511
05110
And so on...
In all tables, there is a text explaining the row and a subreport which contains some further information. The most inner table contains 2 subreports.
How the levels should look without the extra information
And this is how it looks when we try to hide the extra information
The blank space only increases when hiding chosen tables.
This is how the main report looks at the moment
The Expressions contain simple text explaining the level. The [ExprX] contains more detailed info about the level and then the subreport contains even further details.
This nesting became necessary because we only wanted to show levels once. Before that, it was repeating.
Hope this makes it clearer
Found a solution for our problem. Instead of trying to remove the white space we decided to never load the tabels data through several case with expressions in the query builder. Also noticed that such a 'difficult' query (with cases and stuff) had to be made in the "edit as text" inside the query builder.
Example below:
SELECT
CASE WHEN #prmLevel1 = 'true' THEN Table.ColumnName
ELSE NULL
END AS ColumnName
FROM Table
But with lots of more cases after each other.
Hope this can be of help to someone!
Have a great day!

Combining Cells in Locally Rendered Microsoft Report

I have a basic Tablix in my report that currently renders as follows:
These are steps in a manufacturing process with the clock number of the person who performed them with date performed in the last two columns. However, sometimes steps are combined and performed together. In the example above, steps 10-20 are performed together, and 30-40 are performed together. So I would really like the report to be rendered like this:
I do have a column in my data called "StepRange" which in the above example would be "10-20" for the first two rows and "30-40" for the third and fourth rows. So when the value of StepRange is alike, I know those rows are performed together and henceforth the last two columns should be combined. My example shows only two rows being combined at a time, but it could be any number.
How can I make my report look like the second example above instead of the first?
Single Tablix Method
Rather than literal conditional merging, you can set the border style of a textbox using an expression to achieve a similar effect. There are a few steps, but none of them are particularly involved.
Create a parent group for StepRange. Do not add a header or footer, and delete the added column without removing the group.
Make sure that your properties panel is visible on the right of your screen. If not, check the "Properties" checkbox under the View ribbon.
Click on your first detail TextBox and expand the "BorderStyle" property. Set the "Top" property to the following expression:
=IIF(RunningValue(Field!Step.Value,CountDistinct,"StepRange")>1, "None", "Solid")
Set the Bottom property to "None".
Set the expression of the detail TextBox itself.
Replace FIELDNAME with the appropriate field:
=IIF(RunningValue(Field!Step.Value,CountDistinct,"StepRange")>1, "", Field!FIELDNAME.Value)
Repeat this process for each detail TextBox.
You may need to create a dummy row at the bottom with a black top border if you do not have a summation row. (optional)
The expression only evaluates to "Solid" for the first Step value within each StepRange group, so subsequent rows do not have a top border and appear undivided.
Nested Tablix Method
Using a nested Tablix is more straightforward. I have had some issues with them, including some rendering hiccups. But in a report this simple that may not be an issue at all.
Set up your main Tablix to group on StepRange.
Either clear or add a column to the left for the individual steps.
Select "Insert Table" from the toolbar and click on the empty cell.
Set the cells to your step and operation fields and delete the extra column.
The result should look roughly like this:
By default the inner Tablix will be detail grouped. If your detail rows are more granular than the "Step" field, go to the properties of the "(Detail)" group and add a Group Expression for Step.
You can also delete the inner header row if you don't want to see it repeated in the report.
This results in the employee fields actually being merged and spacing properly. If you don't use an aggregate function on those fields, their value will be that of the first row returned internally. Which is moot if their values are uniform across steps.

Set max lines displayed in WebI BO report

How would I set a maximum lines to display in a BO 4 report? On each page, I'd like to show 20 account numbers in column 1 with item counts in the next columns. There are some good discussions on limiting the rows retrieved in a query (e.g., Limit number of result or rows returned in BO using WebI). Some suggestions include using sections with RowIndex()/20 to limit the lines to 20, so I tried adding a variable =Floor(RowIndex()/20). However, the lines in my report contain aggregated variables, and the row index counts all records retrieved. Thoughts?
One option:
Add a column on the far left of the block. Use the following formula:
=Floor(RunningCount([Account Number])/10)
(assuming, of course, that your dimension is named [Account Number])
Create a break on this column. (Report Element -> Table Layout -> Break -> Add Break). Go back to the same menu and click Manage Breaks. Click the "Start on a new page" checkbox.
This will create a block with a maximum of 20 rows per page. Unfortunately, there's no direct way to hide a column in WebI, so you'd be stuck with this ugly column. What you can do, however, is remove all borders, change the font to white-on-white, and reduce its width as much as possible.

SSRS Conditional Formatting

I have a simple List in my report, with a single row and a single column (which is repeated depending on the number of items returned by the query).
What I'd like to do is this: Inside the cell (in the same location), display one rectangle full of items (text boxes, images, etc) for even rows, and another (with different items) for odd rows.
What is the recommended way to accomplish this?
I would use something like this for the Hidden property of the Rectangles:
=IIf(RowNumber(Nothing) Mod 2 = 0, true, false)
Use a different order for true / false for each of the two Rectangles to get them to alternate.
All the expression is doing is checking if a row number is even and setting the visibility based on this.
This is a pretty standard SSRS pattern which is typically used for alternating row colours, but it should work the same for showing/hiding items.