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
' 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) ...

Thanks for your help.
dzu
 
If you use frontpage to create your asp code use the form tool and place form fields in your layout.
To reference your prompts start with prompt0 which is your first selection and set your form attributes which have to include your report name...
 
Do you need to pass those parameters to the report through your ASP code?
 
080898pll, I will try it with frontpage.

LV,
I applied parameter fields in the Crystal Reports and I want to use/show those fields, when a user clickes on a link to a report.
The code of a link like that in a html-page is:
<A HREF=&quot;report.asp?init=actx&rpt=reportname&quot;>Reportname</A>

dzu
 
How do you call your report from report.asp,
using Web Component Server(through the URL) or ASP code(Report Designer Component)?
 
In the moment I call
nameofserver-pc/directory
I have under the SeagateCrystalReports-directory a directory for the CrystalWebReportServer. There are also the actxasp.htm and report.asp.
If I call the URL I get a standard site from Seagate Software to select between CrystalWebReportServer and CrystalWebReportASP. In both cases I can select the viewer Java, ActivX, PlainHTML or HTMLFrames. I always select the ActivX-Viewer and get the actxasp.htm, which shows a list of my reports. The report will announced about the ActivX-Viewer. (Call of the report you can see in the code of my first entry.)
 
That's how I passed parameters:
1.WCS
//servername/reportdirectoryname/report.rpt?prompt0=value_to_pass
2. CRAXDRT.DLL
set oCRParmFields = session(&quot;oRpt&quot;).ParameterFields
for each oCRParmField in oCRParmFields
if oCRParmField.Name = &quot;{?parm_name}&quot; then
oCRParmField SetCurrentValue parm_value, parm_type
end if
next

.......

You should have samples of how to pass parameters installed with Crystal. Try //computername/scrsamples.
The source code should be in Crystal directory under samples.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top