Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

How to run a report for different dates with rs utility? Expand / Collapse
Author
Message
Posted Tuesday, January 8, 2013 7:33 PM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Yesterday @ 10:04 PM
Points: 987, Visits: 1,633
Hi,

I've got a report I need to run many times for different date parameter.

I run the report using the script below with rs utility:
rs -i c:\temp\Report_251212.rss -s http://localhost/reportserver -e Exec2005

Would it be possible to pass the data parameter from rs utility, e.g.:
rs -i c:\temp\Report.rss -s http://localhost/reportserver -e Exec2005 Date = '12/25/12'
rs -i c:\temp\Report.rss -s http://localhost/reportserver -e Exec2005 Date = '12/26/12'
rs -i c:\temp\Report.rss -s http://localhost/reportserver -e Exec2005 Date = '12/27/12'


Thanks.



Dim format as string = "PDF"
Dim fileName as String = "C:\temp\Report_251212.pdf"
Dim reportPath as String = "/Basic Stats/Report"

Public Sub Main()

' Prepare Render arguments
Dim historyID as string = Nothing
Dim deviceInfo as string = Nothing
Dim showHide as string = Nothing
Dim results() as Byte
Dim encoding as string = Nothing
Dim mimeType as string = "application/pdf"
Dim extension as string = "pdf"
Dim warnings() AS Warning = Nothing
Dim reportHistoryParameters() As ParameterValue = Nothing
Dim streamIDs() as string = Nothing

rs.Credentials = System.Net.CredentialCache.DefaultCredentials

Dim parameters(2) As ParameterValue
parameters(0) = New ParameterValue()
parameters(0).Name = "WebsitePrimaryID"
parameters(0).Value = "1"
parameters(1) = New ParameterValue()
parameters(1).Name = "Date"
parameters(1).Value = "12/25/2012"
parameters(2) = New ParameterValue()
parameters(2).Name = "WithPageViews"
parameters(2).Value = "True"
Dim execHeader AS New ExecutionHeader()
Dim rpt AS New ExecutionInfo
rpt = rs.LoadReport(reportPath, Nothing)
rs.SetExecutionParameters(parameters, "en-us")
rs.ExecutionHeaderValue = execHeader
rs.ExecutionHeaderValue.ExecutionID = rpt.ExecutionID
results = rs.Render(format, deviceInfo, extension, mimeType, encoding, warnings, streamIDs)

' Open a file stream and write out the report
Dim stream As FileStream = File.OpenWrite(fileName)
stream.Write(results, 0, results.Length)
stream.Close()

End Sub




Post #1404523
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse