报告服务显示数据格式帮助
我有一个 Tablix,我的查询返回 5 条记录。这是我的查询结果。请让我知道如何显示它们。我很感激任何帮助。谢谢。
2 Test1 20
3 Test2 30
4 Test3 40
5 Test4 50
我必须在报告上以以下格式显示。
Title
-------------------------------------
obj1: Test1 Percentage: 20
obj2: Test2 Percentage: 30
obj3: Test3 Percentage: 40
obj4: Test4 Percentage: 50
I have a Tablix and my query returns 5 records. Here is my query results. Please let me know how to display them. I appreciate any help. Thank you.
2 Test1 20
3 Test2 30
4 Test3 40
5 Test4 50
I have to display in the following format on the report.
Title
-------------------------------------
obj1: Test1 Percentage: 20
obj2: Test2 Percentage: 30
obj3: Test3 Percentage: 40
obj4: Test4 Percentage: 50
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是您可以执行此操作的一种方法。该示例是在 SSRS 2008 R2 中创建的。
该示例假设您已创建数据源并在查询的帮助下使用向导创建了报表。
这是我在本示例中使用的表结构。
报告中使用了以下查询,并且还显示了表记录。
现在,您有了一个像这样的报告,其中每个列都单独显示在报告中。
右键单击第一列并选择表达式...
输入表达式
="Obj" + Cstr(Fields!Id.Value) + ":" + StrDup(10, " ") + Fields!Obj .价值+ StrDup(10, " ") + "Percentage: " + CStr(CInt(Fields!Percentage.Value))
此查询使用
CStr
将整数转换为字符串。我在数字字段中使用了 CInt 来去掉小数。函数StrDup
是将空格复制10次。您可以指定数字来确定需要多少空间。右键单击列 Obj 并选择
删除列
。右键单击列百分比,然后选择
删除列
。展开列 Id 并将标题文本更改为 Title。运行报告,这是输出。
希望有所帮助。
Here is one way you can do this. The example was created in SSRS 2008 R2.
The example assumes that you have created a data source and created a report using the wizard with the help of a query.
This is the table structure I have used for this example.
Following query was used in the report and also the table records are shown.
Now, you have a report like this with each of your columns displayed separately in the report.
Right-click on the first column and select Expression...
Enter the expression
="Obj" + Cstr(Fields!Id.Value) + ":" + StrDup(10, " ") + Fields!Obj.Value + StrDup(10, " ") + "Percentage: " + CStr(CInt(Fields!Percentage.Value))
This query uses
CStr
to convert integers to string. I have usedCInt
for the numeric field to drop off the decimals. The functionStrDup
is to duplicate the space 10 times. You can specify the number to determine how many spaces you need.Right-click on the column Obj and select
Delete Columns
.Right-click on the column Percentage and select
Delete Columns
.Expand the column Id and change the title text to Title. Run the report and here is the output.
Hope that helps.