Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

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

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

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


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("rpt")
viewer = request.querystring("init")

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

' build path to database

set conntemp=server.createobject("adodb.connection")
conntemp.open myConnStr

' Only create the Crystal Application Object on first time through
If Not IsObject ( session ("oApp")) Then
Set session ("oApp") =
End If

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

' Open the report
Set session("oRpt") = session("oApp").OpenReport(rpttoview)

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

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

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

' Now decide what viewer to create
Select Case viewer
    Case "java"

    <param name=ReportName value="rptserver.asp">

    Case "actx"
 <PARAM NAME="Report Name" VALUE="rptserver.asp">
    <PARAM NAME="Show Group Tree" VALUE= 1>
    <PARAM NAME="Show Toolbar" VALUE= 1>

    Case "html_frame"
        response.redirect "htmstart.asp"
    Case "html_page"
        response.redirect "rptserver.asp"
    end select

Thanks for your help.

RE: ASP - How to show paramter fields from the Crystal Report 8.5 report?


First of all, why are you using "Crystal.CRPE.Application" to create Crystal runtime object. If you are using 8.5 on the server you should be using "CrystalRuntime.Application".

But it is different matter. In the code you pasted, where are you filling and passing ParameterFields collection of the report? Or I think you want to know the same.

After setting the calling OpenReport and setting the options, you need to decide which of your reports need to be fed with ParameterFields collection? You can take this decision in Select Case construct based on name of the report. Obviously you will have to hardcode this thing.

You need to do something like this:
set session("CRCol") = Session("oRpt").Parameterfields

set CRCustParam = session("CRCol").item(1)
Call CRCustParam.SetCurrentValue (CStr("Cedric"), 12)

set CRCustParam2 = session("CRCol").item(2)
Call CRCustParam2.SetCurrentValue (CStr("Pioline"), 12)

Like this all the parameters you have to pass in the sequence expected by the report.

For your stringent exception (reports that do not need parameterfields), it is just smooth sailing. You do not need to do anything like the code above. But suppose your report needs dynamic query kind of thing, and then you need to build the query dynamically and set it as following.

session("oRpt").SQLQueryString = cstr(strSt)

Here strSt is the query you will build in your page according to the query string parameters.

Get back if I got you wrong.

Have Fun,
Malay M. Thakershi

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close