tags:

views:

167

answers:

0

Hi. I am trying to create an rdlc report in vb.net 2008 using object datasource. your help will be highly appreciated.

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 the 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 n 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 having 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. i.e.

Itemname         Branch1    Branch2   Branch2
item1               12         2         3

This works fine, as i hav used linq to get the sum of stock values for item in each branch, by handling 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 cant understand how to use the property Stock on Item object to diplay this report. I hav 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 like 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 obvisously, this takes the first item in ItemBindingSource and so, all the stock values are displayed the same.

Please guide me in this subject, as i hav to complete it by today. Thanks in advance