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

Working with dataset and sub reports?

3 Answers 80 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Per
Top achievements
Rank 1
Per asked on 26 Aug 2009, 08:40 AM
Hi!

I'm trying to create your invoice demo example using datasets but I cannot get it to work.
Does parameters and filters work for datasets?

I have a dataset called "dsInvoiceInformation" containing two tables "Header" and "Rows"
In my master report, I have set the datasource to "dsInvoiceInformation" and datamember to "Header".
When I generate my reports, the header information is shown without problem, but how do I bind my "Rows" table to the SubReport datasource/datamember and how do I get it to filter out the rows belonging to the right invoice (from the "Rows" table)?

Regards
Per

3 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 27 Aug 2009, 07:51 AM
Hello Per,

There is not much more we can do than present you with a sample report that already does what you're after. Please review our Invoice demo report carefully from the local Visual Studio examples installed on your machine as well as the video that shows how it is created.

All the best,
Steve
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Per
Top achievements
Rank 1
answered on 28 Aug 2009, 12:36 PM
Hi!

The differense between the demo/sample is that the sub report in the demo is using a select statement to load the data when the report is being generated.

In my case, I already have a dataset full of invoices and rows (it's not possible for me to load the data on demand since it involves lots of data mining).

How can I bind my already populated dataset to the sub report and make it filter out rows from that data ?

Regards
Per

0
Milen
Telerik team
answered on 02 Sep 2009, 03:46 PM
Hello Per,

You basically need to provide the same instance of the dataset as a DataSource of the subreport. You can do that in the NeedDataSource event handler of the SubReport item (the item in the master report, not the report used as subreport).

Here is a sample implementation:
        private void subReport1_NeedDataSource(object sender, EventArgs e)
        {
            Telerik.Reporting.Processing.SubReport subreportItem =
                (Telerik.Reporting.Processing.SubReport)sender;
            subreportItem.InnerReport.DataSource = this.MyDataSet;
            subreportItem.InnerReport.DataMember = "Table2";
        }


Keep in mind that in order for this event to be triggered, the subreport must not have a DataSouce set (set to null).

To filter the detail data for the current invoice in the master report, use the Filters + Parameters technique demonstrated in our Invoice sample as my colleague Steve already suggested.

Hope this information helps.
 

Sincerely yours,
Milen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
General Discussions
Asked by
Per
Top achievements
Rank 1
Answers by
Steve
Telerik team
Per
Top achievements
Rank 1
Milen
Telerik team
Share this question
or