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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP - How to show parameter fields from the Crystal Report 8.5 report?

Status
Not open for further replies.

dzu

Programmer
Sep 12, 2001
5
DE
Hello,

I want using ASP to call reports (version Crystal Reports 8.5) in a local network. The reports based of a database on a sql-server. With the following code I can access of my reports, but I have this problem: in some reports I use crystal parameter fields, so that the user can set a select parameter, but it is not stringent necessary. (Only) the reports with parameter fields dont get displayed - no parameter field, no report. What can I do?

<%
' Get QS variables
rpttoview = request.querystring(&quot;rpt&quot;)
viewer = request.querystring(&quot;init&quot;)

'build full path for report
rpttoview = MID(request.ServerVariables(&quot;PATH_TRANSLATED&quot;),
1, (LEN(request.ServerVariables(&quot;PATH_TRANSLATED&quot;))-11)) &
&quot;\myreportdirectory\&quot; & rpttoview & &quot;.rpt&quot;

' build path to database
myConnStr=&quot;Driver={SQL
Server};server=myservername;PWD=userpassword;UID=username;
Database=databasename&quot;

set conntemp=server.createobject(&quot;adodb.connection&quot;)
conntemp.open myConnStr

' Only create the Crystal Application Object on first time through
If Not IsObject ( session (&quot;oApp&quot;)) Then
Set session (&quot;oApp&quot;) =
Server.CreateObject(&quot;Crystal.CRPE.Application&quot;)
End If

' Turn off all Error Message dialogs
Set oGlobalOptions = Session (&quot;oApp&quot;).Options
oGlobalOptions.MorePrintEngineErrorMessages = 0

' Open the report
Set session(&quot;oRpt&quot;) = session(&quot;oApp&quot;).OpenReport(rpttoview)

' Turn off sepecific report error messages
Set oRptOptions = Session(&quot;oRpt&quot;).Options
oRptOptions.MorePrintEngineErrorMessages = 0

' now set the table location
'Set oDB = session(&quot;oRpt&quot;).Database
'For Each oDBTable In oDB.Tables
' oDBTable.Location = conntemp
'Next

' Opening the page engine will cause the data to be read
Set session(&quot;oPageEngine&quot;) = session(&quot;oRpt&quot;).PageEngine

' Now decide what viewer to create
Select Case viewer
Case &quot;java&quot;
%>

<applet
ALIGN = LEFT
code=ReportViewer.class
codebase=&quot;/viewer/JavaViewer&quot;
id=ReportViewer
width=100%
height=95%>
<param name=ReportName value=&quot;rptserver.asp&quot;>
</applet>

<%
Case &quot;actx&quot;
%>
<OBJECT ALIGN = LEFT ID=&quot;CRViewer&quot; WIDTH=100%
HEIGHT=95%
CLASSID=&quot;CLSID:C4847596-972C-11D0-9567-00A0C9273C2A&quot;

CODEBASE=&quot;/viewer/activeXViewer/CRViewer.dll#Version=1,2,0,30
&quot;>
<PARAM NAME=&quot;Report Name&quot; VALUE=&quot;rptserver.asp&quot;>
<PARAM NAME=&quot;Show Group Tree&quot; VALUE= 1>
<PARAM NAME=&quot;Show Toolbar&quot; VALUE= 1>
</OBJECT>

<%
Case &quot;html_frame&quot;
response.redirect &quot;htmstart.asp&quot;
Case &quot;html_page&quot;
response.redirect &quot;rptserver.asp&quot;
end select
%>

Thanks for your help.
dzu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top