2008-11-10 63 views
3

我正在使用Reporting Services 2005中的XML數據源功能,但在丟失數據時遇到了一些問題。當一行中的第一列沒有值時,SSRS忽略整列!爲什麼SSRS會忽略Web方法返回的某些列的數據?

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列將是完全空的。如果'問題'被顛倒過來,所引發的首先是有價值的,那麼沒有問題。有任何想法嗎?

+0

你有可能發佈RDL嗎? – 2008-11-10 17:49:05

回答

7

在查詢本身中,請嘗試明確定義您的列,而不是讓SSRS爲您確定它們。

換句話說,那就是你有:

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

更換*的東西,如:

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

當然,這確切的XPath可能不適合你的正確的例子。

+0

謝謝!正確的XPath是:GetIssuesResponse/GetIssuesResult/Issue {Title,RaisedBy,Action} – 2008-11-10 18:18:41

0

是否可以消除XML中的NULL?將它們替換爲空字符串?那麼你將不必與SSRS搏鬥。

如果XML是從數據庫調用生成的,那很容易做到(SQL Server中的ISNULL)。

相關問題