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

Reporting newbie... Subreports and Recursive data?

2 Answers 207 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Barry
Top achievements
Rank 1
Barry asked on 16 Aug 2012, 01:06 PM
Hi... I'm pretty new to reporting and I need some help solving a problem..

Firstly, my datasource is a collection of items returned from a web service.  The items can be parents of other items.  I need to create a report that shows all items where IsKey is true.  Then, for each item below that, I need to show the children.  The problem is that since each child can in turn have children, the report needs to be recursive.  My subreport has a parameter and filter on the ID.  My first idea was to add a reference to the same subreport but it says I can't because of circular references.  Is there a way to do this?

Here is an example class

pubic class foo
{
    public Guid ID;
    public String Name;
    public Boolean IsKey;
     
    public List<foo> Children;
}

My report needs to look something like this (where the level can be infinite):

Report Name

--------------



Item.Name
---Item1.Child1.Name
   ---Item1.Child1.Child1.Name
       ---Item1.Child2.Name
       ---Item1.Child3.Name

---Item2.Name

2 Answers, 1 is accepted

Sort by
0
Barry
Top achievements
Rank 1
answered on 16 Aug 2012, 03:48 PM
Ok, so I downloaded the newest version of the Reporting libraries and I can make the circular reference now (I think).  But I followed the instructions at Here to put the sub-report into my main report and it doesn't work.  The main report works but then the sub-reports give an error: "Object reference not set to an instance of an object."  I'm not sure what it is that has a null reference though...
0
Barry
Top achievements
Rank 1
answered on 16 Aug 2012, 07:09 PM
I fixed that last error.  I've figure out that the problem I'm having is that I can't get the data down to the sub report...   I've set up a filter but it doesn't seem to be working.
Tags
General Discussions
Asked by
Barry
Top achievements
Rank 1
Answers by
Barry
Top achievements
Rank 1
Share this question
or