I have a reports that I built in seprate class in web app. The reports are then viewed in web report viewer that also contains date inputs and drop downs to pass parameters to filter report in a custom user control (ascx). The report initally loads fine, but I cannot change the parameters with the drop down controls. What am I missing?
Sub
LoadReport(
ByVal
serviceTypeID
As
Integer
)
Dim
report
As
Telerik.Reporting.Report =
DirectCast
(
Me
.rvServicesSummary.Report, Telerik.Reporting.Report)
Dim
thisUser
As
String
= Membership.GetUser(HttpContext.Current.User.Identity.Name).ProviderUserKey.ToString
Dim
agencyGuid
As
String
= UserProfile.GetCurrentAgencyGUID.ToString
report.ReportParameters(
"ServiceTypeID"
).Value = serviceTypeID
report.ReportParameters(
"CurrentUserID"
).Value = thisUser
report.ReportParameters(
"AgencyGUID"
).Value = agencyGuid
End
Sub
Protected
Sub
RcbServicesSelectedIndexChanged(
ByVal
sender
As
Object
,
ByVal
e
As
System.EventArgs)
Handles
rcbServices.SelectedIndexChanged
LoadReport(
CType
(sender, Telerik.Web.UI.RadComboBox).SelectedValue)
End
Sub
10 Answers, 1 is accepted
Protected
Sub
RbtnPreviewClick(
ByVal
sender
As
Object
,
ByVal
e
As
EventArgs)
Handles
rbtnPreview.Click
'Dim report As Telerik.Reporting.Report = DirectCast(Me.rvServicesSummary.Report, Telerik.Reporting.Report)
Dim
report
As
New
WISHReportsClassLibrary.ReportServicesSummaryMaster
Dim
thisUser
As
String
= Membership.GetUser(HttpContext.Current.User.Identity.Name).ProviderUserKey.ToString
Dim
agencyGuid
As
String
= UserProfile.GetCurrentAgencyGUID.ToString
report.ReportParameters(
"ServiceTypeID"
).Value = rcbServices.SelectedValue
report.ReportParameters(
"CurrentUserID"
).Value = thisUser
report.ReportParameters(
"AgencyGUID"
).Value = agencyGuid
rvServicesSummary.Report = report
Me
.rvServicesSummary.RefreshReport()
End
Sub
We have tested setting the parameters both through the report source and through the report itself. In the button click event handler the report in the report viewer is changed and everything works as expected. As a side note we can recommend you to use the ReportSource property of the Report Viewer instead of the Report property, which is now obsolete. For more information about Report Sources please check the respective article.
As for your code - it seems to be OK, but we cannot tell for sure since we do not have the full source. What you can do is create a very simple example using the examples that get installed along with the product (located in Start -> Telerik -> Reporting Q2 2012 -> Visual Studio 2010 Examples -> C# Solution). For example the Invoice report has a single parameter - try setting this parameter through the external controls you use and check if everything works. Then add the custom logic that you have so that you get closer to the real example.
Additionally you can send us a runnable sample that exhibits the issue so that we are able to view and debug it at our end - this will help us identify the culprit faster. If your data is sensitive you can always use hardcoded dummy data (the ObjectDataSource may help you) instead of the real one.
Kind regards,
IvanY
the Telerik team
BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >
I looked at Q2 2012 VB Example, but one thing I would have a problem with is "All" in the dropdown filter list so it shows all orders instead of just selected order.
I have a question. When report is first rendered it creates a session for the data and the filters work of the cached session data, not re-queying the datastore? If this is true would the best solution, be to reload datasorce for report in preview button and refresh report with new parameters?
The app I have is pretty complicated and there are at least 6 reports with 2 to 4 sub reports in each thme in the report class. It would take sometime to figure out a way to send you a scaled down version of the app.
You can get rid of the obsoletes in a very simple way (this is valid only if they are in the designer.cs file) - just open each report in the designer and change anything, the best would be to turn on/off the snap grid. This will enforce the report to be pre-serialized, using the new syntax.
As for your question - when you change the parameter the query is executed again as changes may have been introduced to the database.
All the best,
IvanY
the Telerik team
BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >
The messages that prevent you from opening the designer are not the obsolete warnings but some other errors, which are typically caused by the resx file in the report definition. You can run the Upgrade Wizard to make sure your upgrade has been successful.
If the problem persists, in order to advise you more appropriately we will need additional information about these errors or you can just send a sample report that reproduces that issue. We will fix it and provide you with steps on how to fix the rest of the reports.
Greetings,
IvanY
the Telerik team
BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >
Sub
LoadReport(
ByVal
serviceTypeID
As
Integer
,
ByVal
startDate
As
DateTime,
ByVal
endDate
As
DateTime)
Dim
report
As
Telerik.Reporting.Report =
CType
(
Me
.rvServicesDetail.Report, Telerik.Reporting.Report)
Dim
agencyGuid
As
String
= UserProfile.GetCurrentAgencyGUID.ToString
report.ReportParameters(
"CurrentUserID"
).Value = thisUser.ProviderUserKey.ToString
report.ReportParameters(
"AgencyGUID"
).Value = agencyGuid
report.ReportParameters(
"ServiceTypeID"
).Value = serviceTypeID
report.ReportParameters(
"StartDate"
).Value = startDate
report.ReportParameters(
"EndDate"
).Value = endDate
Me
.rvServicesDetail.RefreshReport()
End
Sub
Protected
Sub
BtnSubmit_Click(
ByVal
sender
As
Object
,
ByVal
e
As
EventArgs)
Dim
servicesTypeId
As
Integer
=
CInt
(rcbServices.SelectedValue.ToString)
Dim
startDate
As
DateTime = rdStartDate.SelectedDate
Dim
endDate
As
DateTime = rdEndDate.SelectedDate
LoadReport(servicesTypeId, startDate, endDate)
End
Sub
What is the issue?
Your code seems to be ok, but we cannot tell for sure as we do not have the whole thing. Because of that it will be best if you can provide us with a runnable sample that exhibits your issue so that we can reproduce it locally. If you have any sensitive data you can always strip it from the sample.
Kind regards,
IvanY
the Telerik team
BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >
An error has occurred while processing Report 'ReportServicesDetailMaster': An error has occurred while executing function CInt(). Check InnerException for further information. ------------- InnerException ------------- Exception has been thrown by the target of an invocation. ------------- InnerException ------------- Unable to cast object of type 'System.Object[]' to type 'System.IConvertible'.
If the value is truly an int then the exception would not occur. Check your code more thoroughly and also try creating a sample in which you can test only the conversion of the variable. As stated below you can always send as a runnable sample that exhibits the issue.
Regards,
IvanY
the Telerik team
BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >