Thursday, March 29, 2012

Embedding a Report Within Page

Ok, I am getting extremely frustrated here, so I hope someone can help me.

I am trying to pass a parameter to a reportviewer control that is supposed to run a server report. This is how I am doing this:

Dim serverParams(0) As ReportParameter
serverParams(0) = New ReportParameter("RMAID", "3")
Me.RMAReport.ServerReport.ReportServerUrl = New Uri("http://MEDUSA/reportserver")
Me.RMAReport.ServerReport.ReportPath = "/CustomerServiceReports/RMAListingsById"
Me.RMAReport.ServerReport.SetParameters(serverParams)
Me.RMAReport.ServerReport.Refresh()


Now as far as I can tell this should work, but no matter what I do I get

Execution '' Cannot Be Found

Then I can not run any of the server reports at all, not just this one. Going to the reportserver I can run this report just fine. I just can't seem to get it so that this will render. Could someone please help me, I am about to go nuts!!!!

Thank you,

Josh

Ok, so I solved this problem by going from remote processing to local processing...I now have ran into another issue...I'll copy from my post over at the sql server 2005 forums where i have yet to receive a response....

Ok, I have been struggling with getting a report to run that I can pass parameters to for two days now, I have finally made progress on that front from going to local processing vs remote processing.

Now though I am about to pitch my computer underneath a truck if I don't get this solved shortly. I have two subreports as a part of this report. They aresupposedto be passed the id value as a parameter from the parent report. I found out that I still have to set data sources for these sub reports, so I attached the subreportprocessing event to the report viewer and attached the datasources that I created. My problem, I assume, is I don't understand how the dataset is supposed to be defined. I have tried three different ways. I built one dataset that has the relations to the two different tables that the sub reports use and built 3 distinct object data sources that reference the appropriate table adapters in the single dataset and I run the report.

Result I get every record in both tables for each record in the parent report

So next I tried creating three distinct datasets referencing the individual tables that the three reports would use (1 parent 2 child) and assign the datasources to the table adapters for the relevant reports and assigned them in the event.

Result I get every record in both tables for each record in the parent report

Finally I change the dataset to use a parameter to filter out the rows to only be the one for the relevant record in the report. I use the exact same name as the parameter that issupposedto be being passed from the parent report and assign accordingly in the subreportprocessing event

Result I get no error but I get no data either. I am assuming because it is not getting a parameter value.

I can find almost no information on this at all...I'm bashing my head on my desk yelling "WHY?"....this should not be this hard...please someone advise me in the proper direction. If you need any source samples please let me know....

|||

Does anyone have any ideas? I am running out of time to figure this out?

Thank you,

Josh

|||

Hello there:

In case you didn't play this drillthrough sample on:

http://www.gotreportviewer.com/

I am fighting for different issues with this reportviewer. It takes to long to figure out things that is supposed to be documented.

Good luck.

|||

I have spent a lot of time on that site, but it doesn't seem to have what I need.

Unfortunately I am not using drillthrough reports but just two sub reports...I implemented their sub reports exactly as they did except with sql instead of xml, but like I noted I return all results rather than the filtered results.

This truly should not be this hard....I have never wanted to go back to crystal reports until now....this is truly hurting my deadline...

Josh

|||

The reportviewer control is really meant to be used with local reports. Probably if you switched over to fully using the the report server or the reportviewer with local reports, you'll eliminate many of your difficulties.

|||

Hello again:

I look at the sample for the subreport and I found the way you assigned the parameter was different from the sample.

"Finally I change the dataset to use a parameter to filter out the rowsto only be the one for the relevant record in the report. I use theexact same name as the parameter that issupposedto be being passed from the parent report and assign accordingly in the subreportprocessing event"

Actually, you can assign the parameter through the property of the subreport: right click on your subreport> subreport Properties>Parameters: under this tab, you assign your parameter name and value. For example, mainID-- Field!mainID.Value.

I have read tons to find more about this control. I don't know whether this can fix your problem.

<rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" Font-Size="8pt"
Height="100%" Width="100%" AsyncRendering="False" SizeToReportContent="True">
<LocalReport ReportPath="YourMainReport.rdlc" OnSubreportProcessing="ReportViewer1_SubreportProcessing">
</LocalReport>
</rsweb:ReportViewer>

I think in OnSubreportProcessing you simply assign your subreport dataset to datasource. Another thing is to make sure the name of these datasets: yourDataset_yourDatatable. They have to be consistent with the definition in the source of your .rdlc files. You can check them to make sure.

I am close to get what I want to implement. I hope I can share with you with my findings.

|||

Limno,

You are right, I was doing it incorrectly. I solved my problem yesterday by a stroke of luck. You are right in the assumption that I was looking at the parameters incorrectly...I actually needed to pass all possible values to the sub report through the data source. I then needed to go in and make sure filtering was set up on the table that I was using to properly utilize the parameters passed to it. I wish this had been more clear in the documentation, or mentioned at all really, but it wasn't. Anyways, thank you for all of your help and if there is anything I can help with in your problem, please let me know!

Thanks,

Josh

No comments:

Post a Comment