Rdlc 子报表问题,无法在报表或子报表中使用 objectdatasource 中的 List(of Object) 属性
我正在尝试使用对象数据源在 VB.net 2008 中创建 RDLC 报告。
问题是,我的对象数据源是 Item
对象的列表。 每个 Item
对象都有一个名为 Stock
的属性 - 它是 ItemStock
对象的列表。 这两个类的主要属性如下:
Item Class:
Name,Id, Stock,<and some other like MRP,Tax etc.>
ItemStock Class:
BranchId,BatchNo,Expirydate,StockQuantity
单个 Item
对象可以包含每个 BranchId
的多个 ItemStock
项目。因此,Item.Stock
属性将是此类库存商品的并集,即 List(of ItemStock)
。
现在,我的名为 Stock 报告的报告将有一个 List(of Item)
对象作为数据源(绑定源)。我得到了所需的对象列表,没有任何错误。 我将该列表分配给数据网格以显示分支聚合股票值。 也就是说:
Itemname Branch1 Branch2 Branch2
item1 12 2 3
这工作正常,因为我已经使用 LINQ 通过处理 Cell_format
事件来获取每个分支中项目的库存值总和,
但是当我创建报告时,问题就出现了。我的报告需要采用以下格式:
Item1 Name
Branch BatchNo Expiry Quantity
Branch1 12677 12/09/2009 56
Branch1 1217 04/04/2010 6
Branch2 22644 12/03/2011 16
Branch3 72600 12/02/2012 7
Item2 Name
Branch BatchNo Expiry Quantity
Branch1 2677 12/09/2009 5
Branch2 244 12/03/2011 1
Branch3 7200 12/02/2012 7
现在我无法理解如何使用 Item
对象上的 Stock
属性来显示此报告。 我可以选择使用我创建的子报表。但我无法弄清楚如何在处理子报表时分配特定项目对象的库存属性。
我还尝试按如下方式处理 SubreportProcessing
事件:
Private Sub SubreportProcessing(ByVal sender As Object, ByVal e As SubreportProcessingEventArgs)
e.DataSources.Add(New ReportDataSource("Chemasis_BusinessObjects_Objects_ItemStock", ctype(itemBindingSource.Current,Item).Stock))
End Sub
但显然,这需要 ItemBindingSource
中的第一个项目,因此所有库存值都显示为相同的。
I am trying to create an RDLC report in VB.net 2008 using object datasource.
The thing is, my object datasource is a list of Item
objects.
Each Item
object has a property named Stock
- which is a list of ItemStock
objects.
The main properties of both classes are as follows:
Item Class:
Name,Id, Stock,<and some other like MRP,Tax etc.>
ItemStock Class:
BranchId,BatchNo,Expirydate,StockQuantity
A single Item
object can contain a number of ItemStock
items for each BranchId
. The Item.Stock
property will be therefore the union of such stock items, i.e. List( of ItemStock)
.
Now, my report named Stock report will have a List(of Item)
object as a datasource(binding source). I get the required object list with no error at all.
I assign the list to a Datagrid to display branchwise aggregate stock values.
That is:
Itemname Branch1 Branch2 Branch2
item1 12 2 3
This works fine, as I have used LINQ to get the sum of stock values for item in each branch, by handling the Cell_format
event
But the problem arises when I create a report. My report needs to be in format:
Item1 Name
Branch BatchNo Expiry Quantity
Branch1 12677 12/09/2009 56
Branch1 1217 04/04/2010 6
Branch2 22644 12/03/2011 16
Branch3 72600 12/02/2012 7
Item2 Name
Branch BatchNo Expiry Quantity
Branch1 2677 12/09/2009 5
Branch2 244 12/03/2011 1
Branch3 7200 12/02/2012 7
Now I can't understand how to use the property Stock
on an Item
object to display this report.
I have an option of using a subreport, which I created. But I can not figure out how to assign the stock property of particular item object while processing the subreport.
I also tried handling SubreportProcessing
event as follows:
Private Sub SubreportProcessing(ByVal sender As Object, ByVal e As SubreportProcessingEventArgs)
e.DataSources.Add(New ReportDataSource("Chemasis_BusinessObjects_Objects_ItemStock", ctype(itemBindingSource.Current,Item).Stock))
End Sub
But obviously, this takes the first item in ItemBindingSource
and so, all the stock values are displayed as the same.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论