This is a migrated thread and some comments may be shown as answers.

Create a Table with several hierarchy

1 Answer 183 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Julien
Top achievements
Rank 1
Julien asked on 02 Dec 2011, 10:51 AM
Hi, 

I'm creating a report in which I need to display a list of point, I've categories and subcategories. 

I looked at your ProductSales report, which seems to do almost the same thing that I need, but it's not the case:

In my case, I've a collection of Categories, which have a proprty that is a collection of subcategories:

List<Category>
\-->Category
        \-->List<SubCategory>
                \-->SubCategory

And in yours, you have only one object which contains all elements.

I can do a "Group", but I will only have one Item per group(the Category), and I can't display the subGroup in the same table. So how should I do this?

Another problem:
I've a "business key" for both category and subcategory, it's on this key that I can Group, and I need them on the same collumn, I also didn't found this.

It's one of the last piece I miss to create 20+ reports, so I will really be happy if you can explain me how I should do this.

Maybe it's more explicit if I give you a screenshot of what I'm hopping to do with telerik Screenshot of the hopped result

1 Answer, 1 is accepted

Sort by
0
Elian
Telerik team
answered on 02 Dec 2011, 05:32 PM
Hi Julien,

Your case is a bit different from what you anticipate. Typically you would have all the subcategories in one list and you would want to group them according to the categories. However you already have defined grouping (the object hierarchy), so what you want to do is more like flattening the data and simulating grouping.

What I'd suggest is to use objectDataSource (List<Category>) and bind it to the report (possibly to a table too). And then you can nest a table which will show the subcategories (use binding to specify the dataSource List<SubCategory>). 
I have attached a simple project that solves your case (needs some decoration and misses the Key field, but the difference is minor).

Another option would be to flatten the data and use grouping.

Hope this helps.

Kind regards,
Elian
the Telerik team

Q3’11 of Telerik Reporting is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!

Tags
General Discussions
Asked by
Julien
Top achievements
Rank 1
Answers by
Elian
Telerik team
Share this question
or