×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

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?

(OP)
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("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
myConnStr="Driver={SQL
Server};server=myservername;PWD=userpassword;UID=username;
Database=databasename"

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") =
Server.CreateObject("Crystal.CRPE.Application")
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
'Next

' 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"
%>

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

<%
    Case "actx"
%>
<OBJECT ALIGN = LEFT ID="CRViewer"  WIDTH=100%
HEIGHT=95%
 CLASSID="CLSID:C4847596-972C-11D0-9567-00A0C9273C2A"
 
CODEBASE="/viewer/activeXViewer/CRViewer.dll#Version=1,2,0,30
">
 <PARAM NAME="Report Name" VALUE="rptserver.asp">
    <PARAM NAME="Show Group Tree" VALUE= 1>
    <PARAM NAME="Show Toolbar" VALUE= 1>
</OBJECT>

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

Thanks for your help.
dzu

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

Hi DZU,

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
mthakershi@yahoo.co.in

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