本文介绍了如何在SQL 2005 Reporting Services报表的标题中显示数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

开箱即用SSRS报告无法在页面标题中显示数据。有没有办法让这个数据显示?

解决方案

我想要的报告之一是有很好的标题为我的报告。我喜欢将徽标和用户的报告参数与其他数据一起显示,以便为报告需要澄清的业务需求提供更多信息。 Microsoft SQL Server 2005 Reporting Services本身无法执行的一件事是在标题中显示来自数据集的数据。这篇文章将解释如何解决这个问题,以及它是多么容易。



在Business Intelligence Projects部分创建Report Server项目并称之为AdventureWorksLTReports。我使用CodePlex中的AdventureWorksLT示例数据库。





接下来通过右键单击报告区域来显示页眉设计师。



页眉会出现。如果你想显示页面页脚,可以通过与页面页眉相同的菜单访问它。





我创建一个存储过程,它返回销售订单的数据以显示在页眉中。我将在Page Header中显示以下有关销售订单的信息:


  • 订单日期

  • 销售订单号

  • 公司

  • 销售人员

  • 到期总额


我为页面标题中的每个数据字段以及相应标签的文本框创建了一个TextBox。不要在TextBox中更改希望销售订单数据的表达式。





您的报告应该与所显示的屏幕截图类似下面。



最后一步也是最重要的是引用位于Page Header中的TextBoxes中的隐藏文本框。我们使用下面的表达式来引用所需的TextBox:

= ReportItems!.Value

您的报告应该现在看起来类似于以下内容:



您的报表预览现在应在报表标题中包含销售订单标题数据。


Out of the box SSRS reports cannot have data exposed in the page header. Is there a way to get this data to show?

解决方案

One of the things I want in my reports is to have nice headers for my reports. I like to have a logo and the user's report parameters along with other data to show to give more information for the business needs the report needs to clarify. One of the things that Microsoft SQL Server 2005 Reporting Services cannot do natively is show data from a Dataset in the header. This post will explain how to work around this and how easy it is.

Create the Report Server Project in the Business Intelligence Projects section and call it AdventureWorksLTReports. I use the AdventureWorksLT sample database from CodePlex.

alt text http://www.cloudsocket.com/images/image-thumb.png

Next show the Page Header by right clicking in the Report area with the designer.

alt text http://www.cloudsocket.com/images/image-thumb1.png

The Page Header will appear. If you want to show the Page Footer this can be accessed from the same menu as the Page Header.

alt text http://www.cloudsocket.com/images/image-thumb2.png

I created a stored procedure that returns data for the Sales Order to be presented in the Page Header. I will show the following information about the Sales Order in the Page Header:

  • Order Date
  • Sales Order Number
  • Company
  • Sales Person
  • Total Due

I create a TextBox for each of my data fields in the Page Header along with a TextBox for the corresponding label. Do not change the Expression in the TextBoxes that you want the Sales Order data in.

alt text http://www.cloudsocket.com/images/image-thumb3.png

In the Report Body, place a TextBox for each data field needed in the Page Header. In the Visibility for each TextBox, select True for Hidden. This will be the placeholder for the data needed in the Page Header.

alt text http://www.cloudsocket.com/images/image-thumb4.png

Your report should look similar to the screenshot shown below.

alt text http://www.cloudsocket.com/images/image-thumb5.png

The last step and most important is to reference the Hidden TextBox in the TextBoxes located in the Page Header. We use the the following Expression to reference the needed TextBoxes:

=ReportItems!.Value

Your report should now look similar to the following:

alt text http://www.cloudsocket.com/images/image-thumb6.png

Your Report preview should now have the Sales Order Header data in the Report Header.

alt text http://www.cloudsocket.com/images/image-thumb7.png

这篇关于如何在SQL 2005 Reporting Services报表的标题中显示数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 01:43
查看更多