Crystal reports datasource with references

508 Views Asked by At

I am new with crystal reports and have one problem. I need subreport or grouping in table, but problem is that I have two clases Group and Foo, Group has List and I need grouping via Group.Name and display data from Foo.

For example:

    public class Group
    {
        public string Name{get;set;}
        public List<Group> Children{get;set}
        public Group ParentGroup{get;set;}
        public List<Foo> Items{get;set;}
    }

    public class Foo
    {
        public string Name{get;set;}
        public string Number{get;set;}
        public double Price{get;set;}
        public double Quantity{get;set;}
    }

and I want get report grouped by Group.Name and see Foo detail

For example:

Group1


|Name | Number | Quantity | Price | TotalPrice |


|Pen | 01 | 3 | 15 | 45|

|Eraser | 14 | 1 | 20 | 20|

How is the best way to do it? Data is not in database, its only as object in c#. But real problem is reference Group.Items

Thanks for help. Jakub

1

There are 1 best solutions below

4
On

Workaround: Pull out two data tables from database in a single SP.

  1. For the group name and other details as header table, and
  2. From the details based on the group name or id.
  3. Bind these two tables two your crystal report.