如何在报表设计器中并排显示一行上的两行数据? [英] How can I display two rows worth of data on one line side-by-side in Report Designer?
问题描述
我正在使用 SQL Server Reporting Services 2005,并且正在报表设计器/商业智能工作室中开发报表.现在我有一个看起来正常的表格,显示如下数据:
I am using SQL Server Reporting Services 2005, and I'm developing a report in Report Designer/Business Intelligence Studio. Right now I have a normal-looking table that displays data like this:
----------------
| A | B | C |
----------------
| A1 | B1 | C1 |
----------------
| A2 | B2 | C2 |
----------------
| A3 | B3 | C3 |
----------------
我想要做的是,在同一行上并排显示两行,这样表格看起来像这样:
What I would like to do, is display two rows side-by-side on the same line, so that the table would look like this:
-------------------------------
| A | B | C | A | B | C |
-------------------------------
| A1 | B1 | C1 | A2 | B2 | C2 |
-------------------------------
| A3 | B3 | C3 | A4 | B4 | C4 |
-------------------------------
这甚至可能吗?有谁知道如何做到这一点?到目前为止,谷歌搜索对我来说没有任何结果.在此先感谢您的帮助.
Is this even possible? Does anyone know how to accomplish this? Google searches have turned up nothing for me so far. Thanks in advance for any help.
推荐答案
好的,我想出了如何做我想做的事.我创建了一个包含 2 个(重复)表详细信息行的表,其值如下:
Ok, I figured out how to do what I wanted. I created a table with 2 (repeating) table detail rows, with the following values:
--------------------------------------------------------------------------------------------------------------------------------------------
| =Previous(Fields!A.Value) | =Previous(Fields!B.Value) | =Previous(Fields!C.Value) | = Fields!A.Value | =Fields!B.Value | =Fields!C.Value |
--------------------------------------------------------------------------------------------------------------------------------------------
| =Fields!A.Value | =Fields!B.Value | =Fields!C.Value | | | |
--------------------------------------------------------------------------------------------------------------------------------------------
然后我转到每一行的属性,并将隐藏"值设置为一个表达式.对于第一行,我使用了这个表达式:
Then I went to the properties of each row, and set the "hidden" value to an expression. For the first line I used this expression:
=Iif(RowNumber("table1") mod 2 = 0, false, true)
对于第二行,我使用了这个表达式:
For the second line, I used this expression:
=Iif(RowNumber("table1") = CountRows("table1") AND RowNumber("table1") mod 2 = 1, false, true)
这就成功了.它现在显示了我想要的方式.
That did the trick. It now displays how I wanted.
这篇关于如何在报表设计器中并排显示一行上的两行数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!