Hi,
I am trying to create a report with simple SQL query to accept a dynamic parameter during run time. I have checked the Help file and to was only able to find that "parameter" in reporting is supported.
I searched the entire site to my best of ability but was only able to find an outdated video showing how to achieve it in Reporting Q1.
This is driving me nuts to some extend. Is there a full example where I can reference how can I create a report that accepts parameters and initialize the params via the ReportViewer from a web page? I just couldn't get it to work.
And also, I simply can't find the "Edit Expression dialog" from the context menu in the report designer as shown in the help file. Am i missing on something? I am using Reporting Q2 2007.
Any help is really appreciated. Thanks.
Regards.
I am trying to create a report with simple SQL query to accept a dynamic parameter during run time. I have checked the Help file and to was only able to find that "parameter" in reporting is supported.
I searched the entire site to my best of ability but was only able to find an outdated video showing how to achieve it in Reporting Q1.
This is driving me nuts to some extend. Is there a full example where I can reference how can I create a report that accepts parameters and initialize the params via the ReportViewer from a web page? I just couldn't get it to work.
And also, I simply can't find the "Edit Expression dialog" from the context menu in the report designer as shown in the help file. Am i missing on something? I am using Reporting Q2 2007.
Any help is really appreciated. Thanks.
Regards.
6 Answers, 1 is accepted
0
Hi Jason,
I am attaching a sample web site solution which demonstrates how to use report parameters set from a web form. The report parameter is used internally in a filter expression. Please, review the example and let me know if you have any questions regarding its functionality.
The "Edit Expression" dialog is shown in the context menu when you select a report item which has a Value property or you can launch it as a type editor for a Value property from the Properties window (see the attached screenshots).
I hope this information helps. Please let me know if I can be of any further assistance.
Sincerely yours,
Chavdar
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
I am attaching a sample web site solution which demonstrates how to use report parameters set from a web form. The report parameter is used internally in a filter expression. Please, review the example and let me know if you have any questions regarding its functionality.
The "Edit Expression" dialog is shown in the context menu when you select a report item which has a Value property or you can launch it as a type editor for a Value property from the Properties window (see the attached screenshots).
I hope this information helps. Please let me know if I can be of any further assistance.
Sincerely yours,
Chavdar
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0

Benson
Top achievements
Rank 1
answered on 31 Oct 2007, 07:12 AM
Dear Support,
From your sample project, WebReportParams, I understand how you pass parameters to Report1 and show Report1 to ReportViewer.
<<some code from the sample program>>
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim report As Telerik.Reporting.Report = Me.ReportViewer1.Report
report.ReportParameters(0).Value = Me.TextBox1.Text
Me.ReportViewer1.Report = report
End Sub
<<some code from the sample program>>
But in the real situation, ReportViewer will not on the same form as UI (defaultVB.aspx in your case).
My case:
1. defaultVB.aspx:
- Get parameters "From Date" and "To Date"
- 1 'ok button' for running Report1
2. Report1 run and accept defaultVB form input
3. redirect to ReportViewer form and get Report1 object to show out result <<-- HOW ??? -->>
The code something like this:
btnOKClick:
Dim report As New Report1()
report.ParmFromDate = Date1 'ParmFromDate is a property in Report1
report.ParmToDate = Date2
report.ExecuteReport() 'Just a method to run all procedures in Report1
Response.Redirect("~/WebReportViewer.aspx?ReportName=Report1")
Pls. help.
Benson.
From your sample project, WebReportParams, I understand how you pass parameters to Report1 and show Report1 to ReportViewer.
<<some code from the sample program>>
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim report As Telerik.Reporting.Report = Me.ReportViewer1.Report
report.ReportParameters(0).Value = Me.TextBox1.Text
Me.ReportViewer1.Report = report
End Sub
<<some code from the sample program>>
But in the real situation, ReportViewer will not on the same form as UI (defaultVB.aspx in your case).
My case:
1. defaultVB.aspx:
- Get parameters "From Date" and "To Date"
- 1 'ok button' for running Report1
2. Report1 run and accept defaultVB form input
3. redirect to ReportViewer form and get Report1 object to show out result <<-- HOW ??? -->>
The code something like this:
btnOKClick:
Dim report As New Report1()
report.ParmFromDate = Date1 'ParmFromDate is a property in Report1
report.ParmToDate = Date2
report.ExecuteReport() 'Just a method to run all procedures in Report1
Response.Redirect("~/WebReportViewer.aspx?ReportName=Report1")
Pls. help.
Benson.
0
Hi Benson,
There are different approaches for solving the problem. The easiest one is to store the created and initialized report in the asp.net Session object and then take it from there in the report viewer's page. I am attaching a modified example which shows how to achieve this. Depending on your program requirements you can use Reponse.Redirect or Server.Transfer to navigate to the page with the report viewer.
Another possible approach could be to pass the parameters through the query string when requesting the report viewer's page, initialize and create report in it.
I hope this helps. Thank you.
Kind regards,
Chavdar
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
There are different approaches for solving the problem. The easiest one is to store the created and initialized report in the asp.net Session object and then take it from there in the report viewer's page. I am attaching a modified example which shows how to achieve this. Depending on your program requirements you can use Reponse.Redirect or Server.Transfer to navigate to the page with the report viewer.
Another possible approach could be to pass the parameters through the query string when requesting the report viewer's page, initialize and create report in it.
I hope this helps. Thank you.
Kind regards,
Chavdar
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0

Chan Ming Lung
Top achievements
Rank 1
answered on 16 Nov 2007, 10:17 AM
Support,
I encounter an error while following your sample program WebReportParams1 (pass report to session and get the session data in report viewer program).
The error is not specific to Telerik Report. But I hope you can help me.
The error is about the sessionsate and serialization problem. I am using sessionState mode="StateServer" for some reasons and I already added <Serializable()> keyword in vb programs. The point is my report used dataset as the datasource to the Report data, which cannot be serialized in asp.net.
Question:
I need a method to pass report object to the "Report Viewer" program. The session variable method seems to be not ok to me. Can you suggest other methods?
Benson.
I encounter an error while following your sample program WebReportParams1 (pass report to session and get the session data in report viewer program).
The error is not specific to Telerik Report. But I hope you can help me.
The error is about the sessionsate and serialization problem. I am using sessionState mode="StateServer" for some reasons and I already added <Serializable()> keyword in vb programs. The point is my report used dataset as the datasource to the Report data, which cannot be serialized in asp.net.
Question:
I need a method to pass report object to the "Report Viewer" program. The session variable method seems to be not ok to me. Can you suggest other methods?
Benson.
0

Benson
Top achievements
Rank 1
answered on 19 Nov 2007, 10:01 AM
I cancel my previous thread.
I am planning to use session variables to store the report parameters and redirect to ReportViewer. In ReportViewer, it will call the report object.
Thanks for your help.
Benson.
I am planning to use session variables to store the report parameters and redirect to ReportViewer. In ReportViewer, it will call the report object.
Thanks for your help.
Benson.
0
Hi Benson,
It is great that you have found a solution for the problem.
Another possible approaches are to call the ReportViewer.aspx with parameters in the query string or convert the data source to a serializable one. In the second case you will be able to store the report in the Session without problems. However, the specific way which you will choose depends on your exact project requirement.
All the best,
Chavdar
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
It is great that you have found a solution for the problem.
Another possible approaches are to call the ReportViewer.aspx with parameters in the query string or convert the data source to a serializable one. In the second case you will be able to store the report in the Session without problems. However, the specific way which you will choose depends on your exact project requirement.
All the best,
Chavdar
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center