Showing posts with label executing. Show all posts
Showing posts with label executing. Show all posts

Monday, March 26, 2012

report viewer in new window

I'm executing report server from my aspx page as follows:
response.redirect(http://localhost/reportserver?%2fCPlusReports%2fResults&Da
taSource=c:\temp\mydataset.xml)
this seems the easiest way.
Is there any way I can get the report to display in a new window so that my
aspx page still shows?
Thanks,
GDean,
In your ASP.NET page, you can generate script to run in the window onload
event. In your case, this script would call window.open passing the report
URL. Just make sure that you put in window onload to prevent cookie lost if
you are using Forms Authentication. This will guarantee that the script will
run when the page and cookies are loaded.
--
Hope this helps.
---
Teo Lachev, MCSD, MCT
Author: "Microsoft Reporting Services in Action"
http://www.manning.com/lachev
Home page and blog http://www.prologika.com
---
"G. Dean Blake" <Dean@.nospam.com> wrote in message
news:%23eyTdaxhEHA.3148@.TK2MSFTNGP10.phx.gbl...
> I'm executing report server from my aspx page as follows:
>
response.redirect(http://localhost/reportserver?%2fCPlusReports%2fResults&Da
> taSource=c:\temp\mydataset.xml)
> this seems the easiest way.
> Is there any way I can get the report to display in a new window so that
my
> aspx page still shows?
> Thanks,
> G
>|||if you mean when my aspx page is just loading, I don't have the information
yet to generate the report. A purpose of my aspx page is to develop a
dataset to generate the report. My response.redirect is in answer to a
button click event.
"Teo Lachev" <teo@.nospam.prologika.com> wrote in message
news:uylD6E4hEHA.2908@.TK2MSFTNGP10.phx.gbl...
> Dean,
> In your ASP.NET page, you can generate script to run in the window onload
> event. In your case, this script would call window.open passing the report
> URL. Just make sure that you put in window onload to prevent cookie lost
if
> you are using Forms Authentication. This will guarantee that the script
will
> run when the page and cookies are loaded.
> --
> Hope this helps.
> ---
> Teo Lachev, MCSD, MCT
> Author: "Microsoft Reporting Services in Action"
> http://www.manning.com/lachev
> Home page and blog http://www.prologika.com
> ---
> "G. Dean Blake" <Dean@.nospam.com> wrote in message
> news:%23eyTdaxhEHA.3148@.TK2MSFTNGP10.phx.gbl...
> > I'm executing report server from my aspx page as follows:
> >
>
response.redirect(http://localhost/reportserver?%2fCPlusReports%2fResults&Da
> > taSource=c:\temp\mydataset.xml)
> >
> > this seems the easiest way.
> >
> > Is there any way I can get the report to display in a new window so that
> my
> > aspx page still shows?
> > Thanks,
> > G
> >
> >
>|||No, I meant using Page.RegisterClientScriptBlock in your ASP.NET page to
generate dynamically the browser window.onload call instead of using
Response.Redirect, e.g.
StringBuilder sb=new StringBuilder();
sb.Append("<script language=\"javascript\">");
sb.Append("function requestReport");
sb.Append("{");
sb.Append("window.open (<'your report URL'>");
sb.Append("}");
sb.Append("</script>");
this.Page.RegisterClientScriptBlock("script",sb.ToString());
--
Hope this helps.
---
Teo Lachev, MCSD, MCT
Author: "Microsoft Reporting Services in Action"
http://www.manning.com/lachev
Home page and blog http://www.prologika.com
---
"G. Dean Blake" <Dean@.nospam.com> wrote in message
news:u$8xE%237hEHA.632@.TK2MSFTNGP12.phx.gbl...
> if you mean when my aspx page is just loading, I don't have the
information
> yet to generate the report. A purpose of my aspx page is to develop a
> dataset to generate the report. My response.redirect is in answer to a
> button click event.
> "Teo Lachev" <teo@.nospam.prologika.com> wrote in message
> news:uylD6E4hEHA.2908@.TK2MSFTNGP10.phx.gbl...
> > Dean,
> >
> > In your ASP.NET page, you can generate script to run in the window
onload
> > event. In your case, this script would call window.open passing the
report
> > URL. Just make sure that you put in window onload to prevent cookie lost
> if
> > you are using Forms Authentication. This will guarantee that the script
> will
> > run when the page and cookies are loaded.
> >
> > --
> > Hope this helps.
> >
> > ---
> > Teo Lachev, MCSD, MCT
> > Author: "Microsoft Reporting Services in Action"
> > http://www.manning.com/lachev
> > Home page and blog http://www.prologika.com
> > ---
> >
> > "G. Dean Blake" <Dean@.nospam.com> wrote in message
> > news:%23eyTdaxhEHA.3148@.TK2MSFTNGP10.phx.gbl...
> > > I'm executing report server from my aspx page as follows:
> > >
> >
>
response.redirect(http://localhost/reportserver?%2fCPlusReports%2fResults&Da
> > > taSource=c:\temp\mydataset.xml)
> > >
> > > this seems the easiest way.
> > >
> > > Is there any way I can get the report to display in a new window so
that
> > my
> > > aspx page still shows?
> > > Thanks,
> > > G
> > >
> > >
> >
> >
>

Monday, February 20, 2012

Report rendered via webservice not executing from cache

I set a report to 'Cache a temporary copy of the report. Expire copy of
the report on a Shared schedule'
I generate the report using the webservice function Render. All the
settings seem to be set properly, the cache options setting (using
GetCacheOptions) returns True, and the ExpirationDateTime is correct.
So how come when the report is run, it brings up a fresh rendition of
the report (according to the Globals!ExecutionTime variable)?
Could it be something I am not setting correctly when I render the
report? The only thing I am sending are the parameters (which by the
way I am forced to get directly from the database, since RS does not
retrieve second or third level parameters)
Please help!Hello Dear Hella
i need a feavour
i am Working on SQL Reporting Services since one month
i have a problem in generating report across the domains
My client database server is not configured to public domain
i am unable to access the report
So i thought of Using Web service to render the report
currently i am using Report viewer Control
You mentioned in your query that You are using web service
so can u help me in this regard
like what is the design to follow
and i need some code
waiting for your reply
have a good day
Anil Kumar
(anilkumarv@.infotechsw.com)
Hella wrote:
> I set a report to 'Cache a temporary copy of the report. Expire copy of
> the report on a Shared schedule'
> I generate the report using the webservice function Render. All the
> settings seem to be set properly, the cache options setting (using
> GetCacheOptions) returns True, and the ExpirationDateTime is correct.
> So how come when the report is run, it brings up a fresh rendition of
> the report (according to the Globals!ExecutionTime variable)?
> Could it be something I am not setting correctly when I render the
> report? The only thing I am sending are the parameters (which by the
> way I am forced to get directly from the database, since RS does not
> retrieve second or third level parameters)
> Please help!|||Anil,
Here is the code I am using:
Const REPORT_NAME = "/Reporting/Activity Types Detail"
Const FOLDER_PATH = "\\FileServer\Activity Types Detail\"
Dim strConn As String = "Integrated
Security=SSPI;server=servername;database=dbname"
Dim oConn As SqlConnection = New SqlConnection(strConn)
Dim oDataRead As SqlDataReader
Dim forRendering As Boolean = True
Dim historyID As String = Nothing
Dim values As ReportService.ParameterValue() = Nothing
Dim credentials As ReportService.DataSourceCredentials() =Nothing
Dim parameters As ReportService.ReportParameter() = Nothing
Dim catItems As ReportService.CatalogItem() = Nothing
Dim rs As New ReportService.ReportingService
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
rs.Timeout = 36000000 '10 hours
catItems = rs.ListChildren(REPORT_NAME, True)
For Each cItem As ReportService.CatalogItem In catItems
If cItem.Type.ToString.ToLower = "report" Then
Dim report As String = cItem.Path.ToString
WriteLog("Processing report: " & report, True)
If Mid(cItem.Name.ToString, 1, 7) = "Monthly" Then
Try
'gets only 1st parameter values
parameters = rs.GetReportParameters(report,
historyID, forRendering, values, credentials)
If Not (parameters Is Nothing) Then
For Each ParamValue As
ReportService.ValidValue In parameters(0).ValidValues
'txtProgressLog.Text =txtProgressLog.Text & vbCrLf & "Parameter 1: " & parameters(0).Name & "
- " & ParamValue.Value
WriteLog("Parameter 1: " &
parameters(0).Name & " - " & ParamValue.Value, False)
'get second level parameters
Dim strCommand As String = "SELECT
DISTINCT T0.objid AS EmpObjid, T0.first_name + ' ' + T0.last_name AS
EmpName FROM dbo.table_employee T0 INNER JOIN dbo.table_act_entry T1 ON
T0.objid = T1.act_entry2user WHERE (DATEPART(yy, T1.entry_time) = 2005)
AND (T1.entry_time < LTRIM(STR(DATEPART(mm, GETDATE()))) + '/1/' +
LTRIM(STR(DATEPART(yy, GETDATE())))) AND T0.x_department = '" &
ParamValue.Value & "'"
Dim oComm As SqlCommand = New
SqlCommand(strCommand, oConn)
oConn.Open()
oDataRead = oComm.ExecuteReader
'Render reports using parameter
combination
Do Until oDataRead.Read = False
'txtProgressLog.Text =txtProgressLog.Text & vbCrLf & "Parameter 2: " & parameters(1).Name & "
- " & oDataRead(0).ToString
WriteLog("Parameter 2: " &
parameters(1).Name & " - " & oDataRead(0).ToString & " - " &
parameters(2).Name & " - " & oDataRead(1).ToString, False)
'build parameter names and
values
Dim param(2) As
ReportService.ParameterValue
param(0) = New
ReportService.ParameterValue
param(1) = New
ReportService.ParameterValue
param(2) = New
ReportService.ParameterValue
param(0).Name =parameters(0).Name
param(0).Value =ParamValue.Value
param(1).Name =parameters(1).Name
param(1).Value = oDataRead(0)
param(2).Name =parameters(2).Name
param(2).Value = oDataRead(1)
Dim result As Byte() = Nothing
Dim iColon As Int16 = 0
Dim sFileName As String =cItem.Name.ToString & " - " & ParamValue.Value & " - " &
oDataRead(1).ToString & " - " & oDataRead(0).ToString
'remove colon from department name
iColon = InStr(sFileName, ":")
If iColon > 0 Then
sFileName = Mid(sFileName,
1, iColon - 1) & Mid(sFileName, iColon + 1)
End If
rs.SessionHeaderValue = New
ReportService.SessionHeader
result = rs.Render(report,
"HTML4.0", Nothing, Nothing, param, Nothing, Nothing, Nothing, Nothing,
Nothing, Nothing, Nothing)
WriteLog("Execution date and
time: " & rs.SessionHeaderValue.ExecutionDateTime & vbTab & "Is new
execution: " & rs.SessionHeaderValue.IsNewExecution.ToString, False)
Console.WriteLine(("Expiration
date and time: " & rs.SessionHeaderValue.ExpirationDateTime.ToString))
Dim ExpDef As
ReportService.ExpirationDefinition
Console.WriteLine(("Cache
Options: " & rs.GetCacheOptions(report, ExpDef).ToString))
If
rs.SessionHeaderValue.IsNewExecution = True Then
Dim stream As FileStream =File.Create(FOLDER_PATH & sFileName & ".html", result.Length)
stream.Write(result, 0,
result.Length)
stream.Close()
End If
'Process.Start(FOLDER_PATH &
sFileName & ".html")
Loop
oComm = Nothing
oConn.Close()
Next ParamValue
End If
Catch exc As SoapException
Console.WriteLine(exc.Detail.InnerXml.ToString())
WriteLog(exc.Detail.InnerXml.ToString(),
False)
Exit Sub
End Try
End If
End If
Next
Hope it helps.