janineo
asked on
Using Main report datasource in sub reports
Hi,
I have a report which I populate from an ado.net dataset through VB.NET.
However this report has 31 sub reports and it takes a long time to set the datasource for each of these programatically.
However, the dataset is the same for all the subreports and the main report and I was hoping there was a way to just set the datasource in the main report and have it filter through to the sub reports.
I've tried linking the fields in the sub report to identical ones in the main report, but this doesn't work.
Can anyone tell me if this is even possible?
Thanks,
Janine
I have a report which I populate from an ado.net dataset through VB.NET.
However this report has 31 sub reports and it takes a long time to set the datasource for each of these programatically.
However, the dataset is the same for all the subreports and the main report and I was hoping there was a way to just set the datasource in the main report and have it filter through to the sub reports.
I've tried linking the fields in the sub report to identical ones in the main report, but this doesn't work.
Can anyone tell me if this is even possible?
Thanks,
Janine
Thus sub reports have datasets as their datasource. If you use datasets as the subreport's datasource, you have to fill those datasets first too. If not, you can link the main report to subreport and it will work
The link is used to filter the subreport and report on only the related data not to fill the subreport fields with information.
I believe since you are using datasets you will have to assign the datasets as you are doing.
Why does the report require 31 subreports?
mlmcc
I believe since you are using datasets you will have to assign the datasets as you are doing.
Why does the report require 31 subreports?
mlmcc
ASKER
Maybe I should explain it a bit more.
I have a report with 31 sub reports in it.
The data for this report is an XML file which I read into a dataset in VB.NET
I use this to set the datasources:
[code]
Dim objReport As CrystalDecisions.CrystalRe ports.Engi ne.ReportD ocument
Dim objXMLDataDoc As New XmlDataDocument
objReport = New rptEntireCase
' objFixedUpData is an XMLDocument containing all the data I need
objXMLDataDoc.LoadXml(objF ixedUpData .InnerXml)
objReport.SetDataSource(ob jXMLDataDo c.DataSet)
' Then set the sub report datasources
For Each objSubReport In objReport.Subreports
objSubReport.SetDataSource (objXMLDat aDoc.DataS et)
Next
[/code]
The setting of the datasources for the subreports takes a long time - several minutes.
What I would like to do is to just set the datasource for the main report and have the sub reports pick up their data from the main report datasource.
However I have tried linking the fields in the subreports with the fields in the main report and just setting the main report datasource and no data is displayed in the subreports.
Please help
Janine
I have a report with 31 sub reports in it.
The data for this report is an XML file which I read into a dataset in VB.NET
I use this to set the datasources:
[code]
Dim objReport As CrystalDecisions.CrystalRe
Dim objXMLDataDoc As New XmlDataDocument
objReport = New rptEntireCase
' objFixedUpData is an XMLDocument containing all the data I need
objXMLDataDoc.LoadXml(objF
objReport.SetDataSource(ob
' Then set the sub report datasources
For Each objSubReport In objReport.Subreports
objSubReport.SetDataSource
Next
[/code]
The setting of the datasources for the subreports takes a long time - several minutes.
What I would like to do is to just set the datasource for the main report and have the sub reports pick up their data from the main report datasource.
However I have tried linking the fields in the subreports with the fields in the main report and just setting the main report datasource and no data is displayed in the subreports.
Please help
Janine
seems like because you created the sub reports also with datasets you have to fill them up programaticallly. Sub reports are not good for performances and datasets make it worse. But if you can tchnage the datasource to pull method for subreports you have to do what you are doing
Regards
Emre
Regards
Emre
ASKER
ebolek - can you explain what you mean by ' because you created the sub reports also with datasets you have to fill them up programaticallly ' please. How else could I create the sub reports? what other datasource could I use?
mlmcc - I could probably cut down the number of sub reports a bit, but it mostly requires that many because of the data it is displaying - there are lots of distinct tables of data, each needing their own details and header sections, and there are also several places that display an address - which are stored in their own table and therefore need to be in a linked subreport to display the correct one.
I'm sure some of this could be done better if there was a proper database behind it, but it is all based on a single XML document.
mlmcc - I could probably cut down the number of sub reports a bit, but it mostly requires that many because of the data it is displaying - there are lots of distinct tables of data, each needing their own details and header sections, and there are also several places that display an address - which are stored in their own table and therefore need to be in a linked subreport to display the correct one.
I'm sure some of this could be done better if there was a proper database behind it, but it is all based on a single XML document.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
mlmcc
Well, it's nice to know I'm probably doing it the only possible way.
Creating a database probably wouldn't be practical as this report will be running on tablet PCs on site - they wouldn't have the processing capability for it, let alone the software!
I'm thinking I might be able to create smaller datasets from the large one for each subreport as each one generally uses only a few 'tables' of the large dataset. That might speed it up a bit.
Well, it's nice to know I'm probably doing it the only possible way.
Creating a database probably wouldn't be practical as this report will be running on tablet PCs on site - they wouldn't have the processing capability for it, let alone the software!
I'm thinking I might be able to create smaller datasets from the large one for each subreport as each one generally uses only a few 'tables' of the large dataset. That might speed it up a bit.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Emre,
Thanks for the explanation, it makes sense now!
As my data is in an XML file I will have to go for the Push method.
I am splitting the points between you both as you both helped me answer my question - no it's not possible, and I am stuck with my current method.
Thanks,
Janine
Thanks for the explanation, it makes sense now!
As my data is in an XML file I will have to go for the Push method.
I am splitting the points between you both as you both helped me answer my question - no it's not possible, and I am stuck with my current method.
Thanks,
Janine
Reagrds
Emre
Emre
Glad i could help
mlmcc
mlmcc