2011-12-16 134 views
0

我正在處理一組設計並轉換爲Visual Studio 2008 BIDS的報告。報告中心BIDS報告參數

我有一個報告執行以下操作,它沒有在SQL代碼中使用@DistID參數。我確實有一個DistID參數設置。

當報表觀察時,用戶輸入一個號碼到DistID參數框它將重新裝入只是單一DistID報告的報告將加載就好,

SELECT o.Orderid, 
     o.Distid, 
     it.invoicetypedesc, 
     SUM(ol.Volume * ol.Quantity) AS Volume, 
     SUM(ol.Amount) AS Amount, 
     SUM(retailPrice * quantity) AS Retail, 
     o.TaxAmt, 
     o.ShipAmt, 
     o.PostAmount, 
     o.Status, 
     w.WarehouseDesc 
FROM Orders o 
inner join Orderlines ol on o.orderid = ol.orderid 
Inner Join Warehouse w on o.warehouseid = w.warehouseid 
inner join invoicetype it on o.invoicetype = it.invoicetype 
WHERE o.OrderDate between @fromdate and 
          @todate + ' 11:59:59 PM' and 
     o.EnteredBy in (@EnteredBy) AND 
     o.InvoiceType IN (@InvoiceType) 
Group by o.OrderID, 
     o.DistID, 
     it.InvoiceTypedesc, 
     o.taxamt, 
     o.shipamt, 
     o.postamount, 
     o.status, 
     w.WarehouseDesc 

還有其他PARAMATERS設置@ fromDate @toDate等,也工作得很好。

我有另一個報告,我需要相同的功能,除了DistID我需要ItemId。我已經設置了一個參數,並希望它的工作原理相同,但即使在ItemID文本框中輸入項目編號時,報告也會始終加載所有項目。

select ol.itemid, 
     i.description, 
     it.invoicetypedesc, 
     sum(ol.quantity) as quantity, 
     sum(ol.amount) as amount, 
     ol.volume, 
     sum(ol.volume * ol.quantity) as totvolume, 
     o.warehouseid, 
     w.warehousedesc, 
     o.invoicetype, 
     ol.retailprice, 
     ol.wholesaleprice, 
     inv.sku 
from orders o 
inner join orderlines ol on o.orderid = ol.orderid 
left join items i on ol.itemid = i.inventoryid 
left join inventory inv on ol.itemid = inv.inventoryID 
inner join invoicetype it on o.invoicetype = it.invoicetype 
inner join warehouse w on o.warehouseid = w.warehouseid 
where o.orderdate between @fromdate and @todate + ' 11:59:59 PM' and 
     ol.quantity > 0 and 
     o.EnteredBy in (@EnteredBy) 
group by ol.itemid, 
     i.description, 
     it.invoicetypedesc, 
     ol.volume, 
     o.warehouseid, 
     w.warehousedesc, 
     o.invoicetype, 
     ol.retailprice, 
     ol.wholesaleprice, 
     inv.sku 

這兩個報告都是很久以前做出的。我正在修改項目報告以與其他報告中的distID具有相同的功能,但似乎無法使其工作。

我搜索了兩份報告,發現我缺少的任何差異,但找不到任何差異。另一個奇怪的是,當我在DistID報告中添加另一個參數,並通過orderID進一步分解,這也是行不通的。

我在報告的篩選器,變量或代碼部分找不到任何東西。我不知道我在這裏失去了什麼。

+0

請您澄清一下您想問什麼問題,在這裏? – 2011-12-17 17:45:28

回答

0

這裏似乎有不止一個問題。我將專注於(隱含的)第一個問題:爲什麼第二個報告沒有像第一個報告選擇單個DistID一樣選擇單個ItemID?

我認爲根本原因是,有比已經指出的第一份報告更回事 - 因爲其描述到目前爲止,當用戶輸入一個數到DistID參數框報告不應該重載用只有那個單一的DistID。因此,它聽起來好像在用於顯示輸出的表/ tablix報表對象上存在額外的過濾器,或者可能已根據參數值限制了詳細信息行的可見性。

如果是這樣的情況下,你可能通過複製的任何一種方法已用於顯示單一ID複製在所述第二的第一份報告的功能。但是,考慮到此方法產生的維護困難(即這個問題),我強烈建議您將其添加到查詢選擇條件中。

+0

對不起,我失去了這個問題的軌道:就是這樣。我在第一份報告中檢查了我能想到的每一個地方。我無法找到DistID正在過濾的地方。我正在嘗試將DistID從第一個報告到ItemID的方式複製到第二個報告。在第一份報告的報告中是否有一些地方我沒有看到DistID是如何運作的? – 2011-12-20 16:02:45