Posted 14 September 2017, 6:45 pm EST
[activereports_archive]Hello everyone,
I’m quite new to Active Reports so please forgive the rudimentary question.
I’ve designed a report (.rdlx) with ActiveReports Report Designer. When running the report in the designer it works great. I preview the report, type in my two report parameters (StartDate and EndDate) and the correct data returns.
I am now trying to migrate this report into my website (Visual Studio 2012) and am having some trouble passing report parameters into the report. How do I reference and pass a value into a report parameter? For reasons specific to my project, I am trying to do this through code and not through a front end. Here’s what I have so far:
[vb]
'declare page report
Dim rpt As New GrapeCity.ActiveReports.PageReport()
'Load rdlx report I designed in ActiveReports Report Designer
rpt.Load(New System.IO.FileInfo(Server.MapPath("") + "\Reports\LeaveOfAbsence_workingParams.rdlx"))
'Declare report parameter
Dim startDate As New GrapeCity.ActiveReports.PageReportModel.ReportParameter
Dim endDate As New GrapeCity.ActiveReports.PageReportModel.ReportParameter
'this value returns the name of the first parameter I created in ActiveReports Report Designer
Dim sParamName As String = rpt.Report.ReportParameters(0).Name
'> StartDate
startDate = rpt.Report.ReportParameters(0)
endDate = rpt.Report.ReportParameters(1)
'How do I give startDate and endDate a value to pass in?
'startdate.value isn't an option
'run report
rpt.Run()
'Export PDF of report
Dim pdfExport1 As GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport = New GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport()
pdfExport1.Export(rpt.Document, Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "/output/test.pdf")
[/vb]
Can anyone else me pass in my own date values from the code?
Thanks so much![/activereports_archive]