我正在处理一组设计并转换为Visual Studio2008投标的报告。
我有一个执行以下操作的报告,它在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还有其他参数setup @fromDate @toDate等也可以很好地工作。
除了我需要ItemId的DistID之外,我还有另一个需要相同功能的报告。我已经设置了一个参数,并希望它能以同样的方式工作,但即使我在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进一步分解它时,也不会起作用。
我在报告的筛选器、变量或代码部分没有找到任何内容。我不确定我在这里遗漏了什么。
发布于 2011-12-18 01:44:27
这里似乎有不止一个问题。我将集中讨论(隐含的)第一个问题:为什么第二个报告不像第一个报告选择单个ItemID那样选择单个DistID?
我认为潜在的原因是第一个报告中发生了比前面所说的更多的事情--到目前为止,根据它的描述,当用户在DistID参数框中输入一个数字时,报告不应仅使用该单个DistID进行重新加载。因此,听起来好像在用于显示输出的table/tablix报告对象上有一个额外的过滤器,或者细节行的可见性可能是以参数值为条件的。
如果是这种情况,您可以通过复制用于显示单个ID的方法来复制第二个报告中第一个报告的功能。但是,考虑到这种方法产生的维护困难(即。这个问题)我强烈建议您将其添加到查询选择条件中。
https://stackoverflow.com/questions/8541259
复制相似问题