Make whole SSRS report repeat by groups

101 Views Asked by At

I'm not really sure of the best title for this question.

I have a particular problem that seems pretty common but I haven't found a way to solve it yet.

Let's say I have an rdlc report for customers, and it has three sections with subreports:

CUSTOMER_INFO (name, phone, e-mail)

ITEMS

OBSERVATIONS

As the page only has 21cm and the report grows horizontally, I need to repeat the WHOLE report with all of its sections after every 4 customers. So if I have 5 customers, there would be three pages(let's say every subreport takes 1 page) for the first four customers, and then another three pages(with every section once again) just for one customer.

Is it possible? It doesn't seem somehing out of the ordinary, but I can't figure how to make it work. Everytime there is more than 4 customers, the report breaks its layout trying to accommodate the records in a new table below the tables of each subreport. The expected result would be to bring all of exceeding data to new pages.

Thanks in advance.

EDIT:

I made a fiddle to picture exactly what I'm trying to achieve:

Report as it is at the moment:

<html>
    
    <head>
        <meta content="text/html; charset=UTF-8" http-equiv="content-type">
        <title>- jsFiddle demo</title>
        <script src="/js/lib/dummy.js" type="text/javascript"></script>
        <link href="/css/result-light.css" type="text/css" rel="stylesheet">
        <style type="text/css">
            #table, th, tr, td {
                border: 1px solid black;
                margin: 0, 0, 0, 0;
            }
            .wrong {
                width: 100px;
                height: 24px;
            }
            .page {
                text-align: center;
                border: 1px solid black;
                margin-top: 30px;
            }
        </style>
        <script type="text/javascript">
            //&lt;![CDATA[ 
            window.onload = function() {

            } //]]&gt;
        </script>
    </head>
    
    <body>
        <div class="page">
             <h2> PAGE 1 </h2>

            <table style="width:100%">
                <tbody>
                    <tr>
                        <th>CUSTOMER NAME</th>
                        <th>CUSTOMER 1</th>
                        <th>CUSTOMER 2</th>
                        <th>CUSTOMER 3</th>
                        <th>CUSTOMER 4</th>
                    </tr>
                    <tr>
                        <th>ADDRESS</th>
                        <td>some info</td>
                        <td>some info</td>
                        <td>some info</td>
                        <td>some info</td>
                    </tr>
                    <tr>
                        <th>PHONE</th>
                        <td>some info</td>
                        <td>some info</td>
                        <td>some info</td>
                        <td>some info</td>
                    </tr>
                    <tr>
                        <th>EMAIL</th>
                        <td>some info</td>
                        <td>some info</td>
                        <td>some info</td>
                        <td>some info</td>
                    </tr>
                </tbody>
            </table>
            <table>
                <tbody>
                    <tr>
                        <th>CUSTOMER 5</th>
                        <th>CUSTOMER 6</th>
                    </tr>
                    <tr>
                        <td class="wrong">some info</td>
                        <td class="wrong">some info</td>
                    </tr>
                    <tr>
                        <td class="wrong">some info</td>
                        <td class="wrong">some info</td>
                    </tr>
                    <tr>
                        <td class="wrong">some info</td>
                        <td class="wrong">some info</td>
                    </tr>
                </tbody>
            </table>
            <br>
            <br>
            <br>
            <table style="width:100%">
                <tbody>
                    <tr>
                        <th>EXPENSES</th>
                        <td>some info</td>
                        <td>some info</td>
                        <td>some info</td>
                        <td>some info</td>
                    </tr>
                    <tr>
                        <th>TAXES</th>
                        <td>some info</td>
                        <td>some info</td>
                        <td>some info</td>
                        <td>some info</td>
                    </tr>
                    <tr>
                        <th>TOTAL</th>
                        <td>some info</td>
                        <td>some info</td>
                        <td>some info</td>
                        <td>some info</td>
                    </tr>
                </tbody>
            </table>
            <table>
                <tbody>
                    <tr>
                        <td class="wrong">some info</td>
                        <td class="wrong">some info</td>
                    </tr>
                    <tr>
                        <td class="wrong">some info</td>
                        <td class="wrong">some info</td>
                    </tr>
                    <tr>
                        <td class="wrong">some info</td>
                        <td class="wrong">some info</td>
                    </tr>
                </tbody>
            </table>
        </div>
    </body>

</html>

Report as it has to be:

<html><head>
  <meta content="text/html; charset=UTF-8" http-equiv="content-type">
  <title> - jsFiddle demo</title>
  
  <script src="/js/lib/dummy.js" type="text/javascript"></script>
  
  
  
  
  <link href="/css/result-light.css" type="text/css" rel="stylesheet">
  
  <style type="text/css">
    #table,th,tr, td{    
   border: 1px solid black;
   margin: 0,0,0,0;
    
}

.page {
   text-align: center;
   border: 1px solid black; 
   margin-top: 30px;
}
  </style>
  


<script type="text/javascript">//&lt;![CDATA[ 
window.onload=function(){

}//]]&gt;  

</script>


</head>
<body>
  
<div class="page">
   <h2> PAGE 1 </h2>


<table style="width:100%">
    <tbody><tr><th> CUSTOMER NAME </th>
    <th> CUSTOMER 1 </th>
    <th> CUSTOMER 2 </th>
    <th> CUSTOMER 3 </th>
    <th> CUSTOMER 4 </th>
  </tr><tr>
    <th>ADDRESS</th>
    <td>some info</td>  
    <td>some info</td>  
    <td>some info</td> 
    <td>some info</td>
  </tr>
  <tr>
    <th>PHONE</th>
    <td>some info</td> 
    <td>some info</td>  
    <td>some info</td>  
    <td>some info</td>
  </tr>
  <tr>
    <th>EMAIL</th>
    <td>some info</td> 
    <td>some info</td>  
    <td>some info</td>  
    <td>some info</td>
  </tr>
</tbody></table>
    <br>
    <br>
    <br>
    <table style="width:100%">
    
  <tbody><tr>
    <th> EXPENSES </th>
    <td>some info</td>  
    <td>some info</td>  
    <td>some info</td> 
    <td>some info</td>
  </tr>
  <tr>
    <th> TAXES </th>
    <td>some info</td> 
    <td>some info</td>  
    <td>some info</td>  
    <td>some info</td>
  </tr>
  <tr>
    <th> TOTAL </th>
    <td>some info</td> 
    <td>some info</td>  
    <td>some info</td>  
    <td>some info</td>
  </tr>
</tbody></table>

</div>
<div class="page">
   <h2> PAGE 2 </h2>


<table style="width:100%">
    <tbody><tr><th> CUSTOMER NAME </th>
    <th> CUSTOMER 5 </th>
    <th> CUSTOMER 6 </th>
  </tr><tr>
    <th>ADDRESS</th>
    <td>some info</td>  
    <td>some info</td>  
  </tr>
  <tr>
    <th>PHONE</th>
    <td>some info</td> 
    <td>some info</td>  
  </tr>
  <tr>
    <th>EMAIL</th>
    <td>some info</td> 
    <td>some info</td> 
  </tr>
</tbody></table>
    <br>
    <br>
    <br>
    <table style="width:100%">
    
  <tbody><tr>
    <th> EXPENSES </th>
    <td>some info</td>
    <td>some info</td>   
  </tr>
  <tr>
    <th> TAXES </th>
    <td>some info</td>
    <td>some info</td> 
 
  </tr>
  <tr>
    <th> TOTAL </th>
    <td>some info</td>
    <td>some info</td> 
 
  </tr>
</tbody></table>

</div>



  





</body></html>

1

There are 1 best solutions below

0
On

What are you using for your matrix column group formula? I'm guessing you have a number that you use to convert to your Customer number. I used a RowNum field when I did something similar.

To limit the number of columns in a matrix, use the MOD function in the column grouping.

=Fields!ROW_NUM.Value MOD 4

Then add another level of row grouping to break up your Customers -

=INT((Fields!ROW_NUM.Value - 1) / 4)