【问题标题】:Why is SSRS ignoring data from certain columns returned by a web method?为什么 SSRS 会忽略 Web 方法返回的某些列中的数据?
【发布时间】:2008-11-10 17:35:07
【问题描述】:

我正在使用 Reporting Services 2005 中的 XML 数据源功能,但在丢失数据时遇到了一些问题。当一行中的第一列没有值时,似乎整个列都被 SSRS 忽略了!

web方法请求很简单:

<Query>
   <Method Name="GetIssues" 
Namespace="http://www.mycompany.com/App/">
   </Method>
   <SoapAction>http://www.mycompany.com/App/GetIssues</SoapAction>
   <ElementPath IgnoreNamespaces="true">*</ElementPath>
</Query>

同样,响应也很简单:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Body>
    <GetIssuesResponse xmlns="http://www.mycompany.com/App/">
      <GetIssuesResult>
        <Issue>
          <Title>ABC</Title>
          <RaisedBy />
          <Action>Do something</Action>
        </Issue>
        <Issue>
          <Title>ABC</Title>
          <RaisedBy>Jeff Smith</RaisedBy>
          <Action>Do something</Action>
        </Issue>
      </GetIssuesResult>
    </GetIssuesResponse>
  </soap:Body>
</soap:Envelope>

在此示例中,RaisedBy 列将完全为空。如果“问题”被颠倒,那么 RaisedBy 首先有一个值,就没有问题。有什么想法吗?

【问题讨论】:

  • 你有机会发布你的 RDL 吗?

标签: sql-server web-services soap reporting-services


【解决方案1】:

在查询本身中,尝试明确定义您的列,而不是让 SSRS 为您确定它们。

换句话说,你有:

<ElementPath IgnoreNamespaces="true">*</ElementPath>

将 * 替换为:

<ElementPath IgnoreNamespaces="true">GetIssues/GetIssuesItemsResult/listitems/data/row{@Title,@RaisedBy,@Action}</ElementPath>

当然,对于您的示例,确切的 XPath 可能不正确。

【讨论】:

  • 谢谢!正确的 XPath 是:GetIssuesResponse/GetIssuesResult/Issue{Title,RaisedBy,Action}
【解决方案2】:

是否可以消除 XML 中的 NULL?用空字符串替换它们?这样您就不必与 SSRS 搏斗了。

如果 XML 是从数据库调用生成的,那很容易做到(SQL Server 中的 ISNULL)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-12-27
    • 1970-01-01
    • 2021-01-08
    • 1970-01-01
    相关资源
    最近更新 更多