SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


How to run a report for different dates with rs utility?


How to run a report for different dates with rs utility?

Author
Message
Roust_m
Roust_m
Hall of Fame
Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)

Group: General Forum Members
Points: 3596 Visits: 1981
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





Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search