Showing posts with label subreports. Show all posts
Showing posts with label subreports. Show all posts

Wednesday, March 21, 2012

problem Having two seperate queries for mainreport and subreport

In my project i have a mainreport and two subreports.

I am able to work with this only if i have a single query to retrieve datas for all the three reports.

But my requirement is i have to pass three different queries to get data for all the three reports seperately.

The three reports are retirieved form different tables.

As i have used one single query , i have a doubt wheather the query may have if it is put to live database as it will be used by many users at the same time.

I want seperate queries to improve the performance of the report generation

can any one please help to get the solution for my requirement.

thanks in advance.

vijiI've made a lot of Crystal Reports reports using a master detail structure (a main report and subreports describing detail sections). The reports use seperate queries and the subreports can be linked to the main report using the Subreport Links feature in the Edit menu. This works fine in Crystal versions 8.5 ->.

If I want to return a value from a subreport to the main report I use a shared type variable.

I hope this helps, if not please describe in more detail your problem.

- Jukka|||Thanks jukka for your reply.

I created two different DataAdapters and one dataset in the adapters i passed my queries and filled the dataset with the virtual table name and pass this dataset as the datasource for the reports and it is working fine

As i give the data for the variable in the same form itself a shared variable was not needed for me

One main thing is i created all my reports inside the bin directory

the code which i used for the report is

form level::::
Dim Ds_cust As DataSet
Dim Rpt_Doc As ReportDocument
Dim da_cust As SqlClient.SqlDataAdapter
Dim da_tmp As SqlClient.SqlDataAdapter

Dim ls_agree_code, strReportName As String

Button Click:::::

ls_agree_code = Trim(Me.txt_agr_cd.Text)

Ds_cust = New DataSet
Rpt_Doc = New ReportDocument
strReportName = "main_rpt"(give your mainreport name)

Dim strReportPath As String = Application.StartupPath & "\" & strReportName & ".rpt"

If Not IO.File.Exists(strReportPath) Then
Throw (New Exception("Unable to locate report file:" & vbCrLf & strReportPath))
End If

I am filling the dataset thru the different adapters

da_cust = New SqlClient.SqlDataAdapter("select query here", "Server=testserver;User ID=sa;Database=bimscd_test")
da_cust.Fill(Ds_cust, "cust")

da_tmp = New SqlClient.SqlDataAdapter("select query here", "Server=testserver;User ID=sa;Database=bimscd_test")
da_tmp.Fill(Ds_cust, "tmp")

assigning the datasource for the reports

Rpt_Doc.OpenSubreport("sub_rpt.rpt").SetDataSource(Ds_cust.Tables("cust"))

Rpt_Doc.SetDataSource(Ds_cust.Tables("tmp"))

assigning the report source for the report viewer

RptViewer.ReportSource = Rpt_Doc
Rpt_Doc.Refresh()
da_cust = Nothing
Ds_cust = Nothing

Monday, March 12, 2012

Problem Deploying Subreports with Main Report

Hi All,

Here's my problem. I have an SSRS report with subreports on it. The main report and subreports work fine on my machine when I run the main report. However, when I deploy them to our test server and change the server name of the shared datasource, only the main report brings back data. The subreports show an error of something like "Error in displaying the subreport" for each subreport. The subreports require parameters that I believe I am supplying from the main report. What am I doing wrong? Is it really necessary to deploy the subreports with the main report to the new server. With Crystal Reports, I didn't have to do this. Any thoughts or suggestions would be appreciated.

Are you sure that the subreports are using the shared datasource? Can you run any of the subreports by themself?

|||

SteffoS,

Thanks for replying. Yes, I can run the subreports individually and get data. Thanks again. Any other suggestions?

|||

Hi All,

I found the answer to my problem. When I right clicked on the subreport and chose properties then went to the parameters tab, I chose the Fields.fieldName.Value for the the value of my parameter. This is incorrect. What I needed to do and did was choose the <expression> item in the dropdown box then click on parameters and choose the correct parameter from the main report to be the value for the parameters in my subreport. Worked like a charm, but I'm not getting too excited. I've read too much that things just started working for people and they could not explain why. That's scary too. Thanks.

Problem Deploying Subreports with Main Report

Hi All,

Here's my problem. I have an SSRS report with subreports on it. The main report and subreports work fine on my machine when I run the main report. However, when I deploy them to our test server and change the server name of the shared datasource, only the main report brings back data. The subreports show an error of something like "Error in displaying the subreport" for each subreport. The subreports require parameters that I believe I am supplying from the main report. What am I doing wrong? Is it really necessary to deploy the subreports with the main report to the new server. With Crystal Reports, I didn't have to do this. Any thoughts or suggestions would be appreciated.

Are you sure that the subreports are using the shared datasource? Can you run any of the subreports by themself?

|||

SteffoS,

Thanks for replying. Yes, I can run the subreports individually and get data. Thanks again. Any other suggestions?

|||

Hi All,

I found the answer to my problem. When I right clicked on the subreport and chose properties then went to the parameters tab, I chose the Fields.fieldName.Value for the the value of my parameter. This is incorrect. What I needed to do and did was choose the <expression> item in the dropdown box then click on parameters and choose the correct parameter from the main report to be the value for the parameters in my subreport. Worked like a charm, but I'm not getting too excited. I've read too much that things just started working for people and they could not explain why. That's scary too. Thanks.

Wednesday, March 7, 2012

Problem creating Subreports

Dear All,

I m feeling prblem in creating subreports, the sitauation is that i have careated an report by using stored procdure, and i added a subreport which is also using a stored procedure wihich required 3 parameters, which will be passed from main report, so at this moment i m unable to pass parameters to stored procedure coz it requires descreat values, but i want to pass parameters values,

so kindly tell me anybody, how i can pass parameters to stored procedure in sub reports.

looking forward for kind reply

with best regards,

A d e e l MehmoodYeah..Im having the same problem..however my report isnt based off of a stored procedure, its asking for a discrete value and I want to pass it a dynamic value as well..whats the fix?

-thanks

Jim