Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open a report in a new browser

Status
Not open for further replies.

gearheadgood

Programmer
Dec 12, 2003
8
US
Is there a way to launch a report in a new browser window ?

I have a launchreport.asp which calls my showreport.csp.

Can;t quite figure out how to open the report in a new browser window !

tks,
 
Hi,
You can do it in a JavaScript function:
( snippet below)

Code:
function RunRpt{
windowprops = "fullscreen=no,location=yes,scrollbars=no,menubars=no,toolbars=no,resizable=yes";
reportWindow=window.open(<YourUrl>,&quot;rptWindow&quot;,windowprops);
}


Of course you will need to handle the call to the function in your ASP ( or CSP) page and you can also add parameters to the call to set the URL or other stuff

[profile]

 
Here is my current code, works like a charm:

Dim sTemp

sTemp = crReportID & &quot;&promptex-CenterName=&quot; & Replace(CenterName, &quot;&&quot;, &quot;§&quot;) & _
&quot;&promptex-DischargeFilter=&quot; & CStr(DischargeFilter) & _
&quot;&promptex-StartDate=&quot; & StartDate & _
&quot;&promptex-EndDate=&quot; & EndDate

Response.Redirect(&quot;../Reports/LaunchReport.asp?ReportID=&quot; & sTemp)

LaunchReport.asp calls the ShowReport.csp

Should I add the java code to the ASP page and call it instead of the Response.Redirect ?

tis,
M
 
Hi,
I think JavaScript is the only way to get a new window, but experienced ASP/VbScript coders may know otherwise..
For your example you could use on your calling page:

Code:
<HEAD>
<SCRIPT Language=&quot;JavaScript&quot;>

function RunRpt(pstr){
var qstr = pstr
locstr = &quot;http:\\servername\Reports\LaunchReport.asp?ReportID=&quot; + qstr
windowprops = &quot;fullscreen=no,location=no,scrollbars=no,menubars=no,toolbars=no,resizable=yes&quot;;
reportWindow=window.open(locstr,&quot;rptWindow&quot;,windowprops);
}
</SCRIPT>
</HEAD>

Then add a calling button in the BODY section of your Page:


Code:
<input type=&quot;button&quot; value=&quot;Run the Report&quot; OnClick=RunRpt(&quot;<%=sTemp %>&quot;)>

Above assumes sTemp will be defined first and then you can pass it as an ASP Variable.

[profile]


 
Getting Close:

Here's the code:

function RunRpt(pstr){
var qstr = pstr
locstr = &quot;LaunchReport.asp?ReportID=&quot; + qstr
windowprops = &quot;fullscreen=no,location=no,scrollbars=no,menubars=no,toolbars=no,resizable=yes&quot;;
reportWindow=window.open(locstr,&quot;rptWindow&quot;,windowprops);
}

I call this in the client side onLoad event:
RunRpt(&quot;<%=crReportID%>&quot;)

I get a crystal error:
Error encountered by Crystal PageServer
------------------------------------

The error message returned is:

File E:\woundstar_new\Reports\viewrpt.cwr not found. [On Page Server: JKAWEB02.pageserver]

I know it's there, because this report works fine the &quot;old&quot; way when I dont try and opena new window. Is it something in the way variable &quot;crReportID&quot; is passed ?

crReportID is a variable that I get from the passing URL.

tks,
 
Hi,
Can I see the code that is executed before the OnLoad event?

[profile]
 
I too experienced the viewrpt.cwr not found error and I was told to stopt and start all the processes on CCM. It worked for me. (CR 8.5)
 
Here is the code I run in the before show event:

Function Page_BeforeShow()
Dim CenterID
Dim StartDate
Dim EndDate
Dim crReportID

CenterID = Request.QueryString(&quot;CenterID&quot;)
StartDate = Request.QueryString(&quot;StartDate&quot;)
EndDate = Request.QueryString(&quot;EndDate&quot;)
crReportID = Request.QueryString(&quot;crReportID&quot;)
Call RunStoredProc(CenterID, StartDate, EndDate)
End Function
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top