This is a migrated thread and some comments may be shown as answers.

Pull InstanceReportSource name from Database

1 Answer 85 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mike Maynard
Top achievements
Rank 1
Mike Maynard asked on 01 Oct 2014, 03:59 PM
Hi everyone,
I am deploying a custom winform application that will use a database table to lookup reports that a user is allowed access to.
The table is just 3 fields
rptID, rptName, and rptDescription

On load of the Report  Form I query the database using the users ID and pull in the 3 fields above to create a group of radio buttons on the form.
What I need to be able to do is then load another form with a reportviewer on it when the user selects a radio button.

Is there anyway to take the string value of rptName and dynamically load it into the ReportViewer on the called form?

I am using instancereportsource with a compiled DLL of reports.

I can hard code the reports and use a Select Case on reportname but I would rather have it be dynamic so that I can add reports later on after the application is deployed by just replacing the reports DLL file.

The code I currently use for the hard coded select case is
Select Case ReportName
            Case "IncidentListingReporting" 
                Dim FullnameRpt2 As New Telerik.Reporting.InstanceReportSource 
                FullnameRpt2.ReportDocument = New Reporting.IncidentListingReport
                FullnameRpt2.Parameters.Add(New Telerik.Reporting.Parameter("SDate", Param2))
                FullnameRpt2.Parameters.Add(New Telerik.Reporting.Parameter("EDate", Param3))
                FullnameRpt2.Parameters.Add(New Telerik.Reporting.Parameter("PNUM", Param4))
                ReportViewer2.ReportSource = FullnameRpt2
End Select

What I would like is to be able to do something like
                FullnameRpt2.ReportDocument = Param1

Thanks for any help!


1 Answer, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 06 Oct 2014, 06:58 AM
Hello Mike,

You can use the Activator.CreateInstance Method after retrieving the correct type name from the database.

Another approach is to replace the InstanceReportSource with another report source more suitable in your scenario. Please check the available report sources in the Report Sources help article.

Regards,
Nasko
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
General Discussions
Asked by
Mike Maynard
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Share this question
or