HOW TO Select Distinct Rows When Bound To Business Objects RRS feed

  • Question

  • I am working in .NET 2.0 with C# windows forms and have an .RDLC in place bound to a custom Business Object that exposes many fields.

    In my report, I only want a few fields exposed, but due to the underlying BO, many duplicates are coming through.  Is there any easy from the .RDLC designer to bring back only distinct rows from the exposed fields?  

    Thanks in advance for any advice! 
    Thursday, October 9, 2008 5:59 PM

All replies

  • One way to accomplish this would be to remove duplicates in your code, before you give it to the report viewer.

    Another way is to modify all of the data regions in your report. You would need to insert a group around all of you detail groups, which groups by all of the significant fields, and then delete the details group.

    If you have many data regions you should modify the data before it gets to your report. If you need to be able to refresh the report to get updated underlying data, then you'll need the data source object given to the report to reflect the underlying data. This can be done by creating a new Enumerable type, with an enumerator which will order the underlying data and then skip past duplicates. Or if the underlying data is in a DataTable, then you could attach to the DataTables events, and modify the report viewers data source when the DataTable gets modified.

    Nick Allen, Microsoft SQL Server Reporting Services. This posting is provided "AS IS" with no warranties and confers no rights.
    Friday, October 10, 2008 12:06 AM