简体   繁体   English

SSRS 2008报表动态标头可在BIDS中的本地计算机上运行,​​但不能从报表服务器中运行

[英]SSRS 2008 Report Dynamic Header works on local machine in BIDS but not from Report Server

I have a report that consists of a single column tablix with a single row that is grouped. 我有一个报告,其中包含一个单列tablix和一个分组的单行。 Inside the row are three sub reports. 该行内有三个子报告。 The Header of the report is supposed to display three pieces of information unique to the data that the row is grouped on so the header is unique for each. 报表的标题应该显示三条信息,这些信息对于行进行分组的数据来说是唯一的,因此每个文件的标题都是唯一的。

I attempted to populate the data in the header by having hidden controls in the body that I then referenced in the expressions of the controls in the header. 我试图通过在主体中具有隐藏的控件来填充标题中的数据,然后在标题中的控件表达式中引用该控件。 This method didn't work. 此方法无效。 So I switched to a different possible solution I found which was to populate variables using VB and reference them in the header using =Code.variableName in the expression. 因此,我转到了另一种可能的解决方案,即使用VB填充变量,并使用表达式中的=Code.variableName在标头中引用它们。 The function to populate the variables is called from a hidden control in the body which passes the data as parameters. 从体内的隐藏控件调用填充变量的函数,该控件将数据作为参数传递。

This method worked. 此方法有效。 However, it only seems to work on my local machine and one of my coworker's machines in BIDS preview. 但是,在BIDS预览中,它似乎只能在我的本地计算机和同事的一台计算机上工作。 When the report is published to the report server, it runs and everything seems fine, except the header values don't populate. 将报表发布到报表服务器后,它将运行,并且一切看起来都不错,但不填充标头值。

One of the variables is an integer and the other two are strings. 变量之一是整数,另外两个是字符串。 The integer value is initialized to 0 and in the report from the report server it shows the initialized value of 0, but the strings are still blank. 整数值被初始化为0,并且在报表服务器的报表中,它显示了初始化值0,但是字符串仍然为空。 This makes me think that the function isn't being called or there might be a scope issue? 这使我认为未调用该函数,或者可能存在范围问题? Or it could be something completely different that I'm not familiar with. 或者可能是我不熟悉的完全不同的东西。 Possibly a configuration issue with the report server? 报表服务器可能存在配置问题?

Here is the report: 这是报告: 报表设计器的屏幕截图

If you can see the tiny little control about halfway down the report on the left side. 如果您可以在左侧报表的中途看到一个很小的小控件。 Its just a tiny little box.. The expression for that control is: 它只是一个小盒子。.该控件的表达式是:

=Code.GetHeaderData(Fields!SEPID.Value, Fields!FullName.Value, Fields!Level.Value)

The Function is: 函数是:

    Shared Public Dim SEPIDVar as Integer
    Shared Public Dim FullNameVar as String
    Shared Public Dim LevelVar as String

Public Shared Function GetStudentHeaderData(
    ByVal sepid as Integer, 
    ByVal fullname as String, 
    ByVal level as String)
        SEPIDVar = sepid
        FullNameVar = fullname
        LevelVar = level
End Function

The three header controls have the following expressions: 三个标头控件具有以下表达式:

=Code.FullNameVar
=Code.SEPIDVar
=Code.LevelVar

And then here are some screenshots showing the difference in how the report looks when I preview it locally from BIDS vs running it on sql report server: 下面是一些屏幕快照,显示了当我从BIDS本地预览报表与在sql报表服务器上运行报表时报表的外观差异:

The working header when viewing preview in BIDS 2008 on local machine: (values distorted) 在本地计算机上的BIDS 2008中查看预览时的工作标头:(值失真) 在此处输入图片说明

And the broken header when viewing the report from the report server: 从报表服务器查看报表时,标题也损坏了: 在此处输入图片说明

I've spent multiple days now scourging the internet for a solution to no avail. 我花了好几天的时间在网上搜寻无济于事的解决方案。 Any help in troubleshooting why this is happening would be greatly appreciated! 排除故障原因的任何帮助将不胜感激!

It seems that the Report Server doesn't run your code before the header is created. 似乎报表服务器在创建标头之前不会运行您的代码。 Obviously, it seems to work in BIDS. 显然,它似乎在BIDS中有效。

Can you move the headers down to be part of your report so you can just use the fields? 您可以将标题向下移动到报告的一部分,以便仅使用字段吗?

If not, have you tried using ReportItems ? 如果不是,您是否尝试过使用ReportItems See this TechNeT for more info. 有关更多信息,请参见此TechNeT

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM