使整个 SSRS 报告按组重复
本文关键字:报告 SSRS | 更新日期: 2023-09-27 17:56:09
我不太确定这个问题的最佳标题。
我有一个似乎很常见的特殊问题,但我还没有找到解决它的方法。
假设我有一个针对客户的 rdlc 报告,它有三个包含子报表的部分:
CUSTOMER_INFO(姓名、电话、电子邮件)
项目
观察
由于页面只有 21 厘米,并且报告水平增长,我需要在每 4 个客户之后重复整个报告及其所有部分。因此,如果我有 5 个客户,那么前四个客户将有三页(假设每个子报表占用 1 页),然后另外三页(每个部分再次)只针对一个客户。
可能吗?这似乎并不奇怪,但我不知道如何让它工作。每当客户超过 4 个时,报表就会中断其布局,试图在每个子报表的表下方的新表中容纳记录。预期结果是将所有超出的数据带到新页面。
提前谢谢。
编辑:
我做了一个小提琴来准确地描绘我想要实现的目标:
按当前情况报告:
<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">
//<![CDATA[
window.onload = function() {
} //]]>
</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>
报告必须:
<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">//<![CDATA[
window.onload=function(){
}//]]>
</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>
您的矩阵列组公式使用什么?我猜您有一个用于转换为客户编号的号码。当我做类似的事情时,我使用了 RowNum 字段。
要限制矩阵中的列数,请在列分组中使用 MOD 函数。
=Fields!ROW_NUM.Value MOD 4
然后添加另一个级别的行分组来分解您的客户 -
=INT((Fields!ROW_NUM.Value - 1) / 4)