none
Filtering Child Records by the Parent ID RRS feed

  • Question

  • Hi,

     

    I'm stuck on a baffling issue.  Using VS05 Report Viewer, I have a report with a parent/child layout.  Its an invoice containing invoice details on the parent record and invoice items for child records.

     

    I create the table for the child records using the related child table adapter from the datasource, but when I run it, it shows every record in the child table.  Nothing is filtered to the parent ID.

     

    Will I have to manually perform the filtering?  Or is there something I missed?

    Can anyone point me to a good reporting resource I can learn from?

     

    Thanks heaps,

    Kiavash

    Tuesday, August 21, 2007 12:28 PM

Answers

  • You can filter the records in the child table adapter by passing the master-field say invoiceid as a paramter. You should also specify where this param comes from in the objectdatasource for that table. So the child table adapter only has records for the particular invoiceid.  I'm assuming its a one to many report and u're calling the report on one invoiceid.

    Tuesday, August 21, 2007 1:05 PM

All replies

  • You can filter the records in the child table adapter by passing the master-field say invoiceid as a paramter. You should also specify where this param comes from in the objectdatasource for that table. So the child table adapter only has records for the particular invoiceid.  I'm assuming its a one to many report and u're calling the report on one invoiceid.

    Tuesday, August 21, 2007 1:05 PM
  • Thanks for the super quick reply.

     

    You're quite right in every assumption and your idea would work.  I just had to ask before I did this.

     

    The reason I questioned this method is that ADO.Net can handle this kind of filtering very well in forms.  So I wondered if it would also be the case in the report viewer.

     

     

    Thanks again.

    Tuesday, August 21, 2007 1:21 PM