Search code examples
c#winformsreportingrdlctabular

Microsoft Report: Use a table in column of another table


I need a table that represent list of all Projects table data in report. But I need a column to show list of people that works on current project(row).

When put a table in another table column in Microsoft Report (RDLC), I can't change DataSetName of this table to People.

I need a table like this:

RowNumber  |  Project Name  | Total People | People List
______________________________________________________________
    1      |    Project 1   |      2       | Name | Surname
           |                |              |_______________
           |                |              |  AA  |   AA
           |                |              |  BB  |   BB

--------------------------------------------------------------
    2      |    Project 2   |      4       | Name | Surname
           |                |              |_______________
           |                |              |  AA  |   AA
           |                |              |  EE  |   EE
           |                |              |  FF  |   FF
           |                |              |  DD  |   DD

How can I do this? Any one has sample or trick for this ?


Solution

  • It isn't very difficult. Just look from the direction of people.

    1. Create table.

    2. Create Class for this report.. smth like:

      public class PersonInfo { public string LastName { get; set; }

      public string FirstName { get; set; }
      
      public string ProjectName { get; set; }
      

      }

    3. Dataset for your table (for example) is a collection of personInfos..

    4. Group by ProjectName

    5. RowNumber... try smth like this:

      =RunningValue(Fields!ProjectName.Value, CountDistinct, Nothing)

    Everything is ready!

    p.s. : if there will be problems with 'Total' column (though I don't think), you may add one more property to class and set value you need.

    Maybe this answer will help you.