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!

Can i pass parameters to Crystal 8 on the web from ASP

Status
Not open for further replies.

rishi145

Programmer
Jul 12, 2001
6
GB
I have a date from and date to fields that i need tio pass to cystal can i do this if So can anyone show me the syntex to do this.

Cheers
Rishi
 
Crystal Report Parameter Fields

' CREATE THE APPLICATION OBJECT
If Not IsObject (session("oApp")) Then
Set session("oApp") = Server.CreateObject("Crystal.CRPE.Application")
End If
' CREATE THE REPORT OBJECT
'
'The Report object is created by calling the Application object's OpenReport method.

Path = Request.ServerVariables("PATH_TRANSLATED")
While (Right(Path, 1) <> &quot;\&quot; And Len(Path) <> 0)
iLen = Len(Path) - 1
Path = Left(Path, iLen)
Wend

'OPEN THE REPORT (but destroy any previous one first)

If IsObject(session(&quot;oRpt&quot;)) then
Set session(&quot;oRpt&quot;) = nothing
End if

Set session(&quot;oRpt&quot;) = session(&quot;oApp&quot;).OpenReport(path & reportname, 1)
'you must open that report by creating a new session(&quot;oRpt&quot;) object.

set session(&quot;oRptOptions&quot;) = Session(&quot;oRpt&quot;).Options
session(&quot;oRptOptions&quot;).MorePrintEngineErrorMessages = 0

session(&quot;oRpt&quot;).DiscardSavedData

' Insert a value for the Crystal Report Parameter Field

Session(&quot;oRpt&quot;).Parameterfields(0).SetCurrentValue (CStr(&quot;Any valur&quot;),12)
Session(&quot;oRpt&quot;).Parameterfields(0).SetCurrentValue (CDbl(&quot;1223.44&quot;),8)

'The first parameter passed to the SetCurrentValue method is the value
'that you want to pass to the Crystal Reports parameter field. The
'second parameter is the datatype of the value you are passing to the
'Crystal Parameter field.

'Since we are passing a VBScript variable as the value for the parameter
'we must cast the variable as the proper datatype before passing it to
'the report. This is because VBScript variables are not datatyped unless
'cast.

'Below is a list of Crystal Data types, the VBScript cast functions and
'data type qualifier parameter to pass to the SetCurrentValue method:

' Param Field Type VBScript Call Type Number
'
' NumberField CDbl 7
' CurrencyField CDbl 8
' Boolean CBool 9
' StringField CStr 12


' Retrieve the Records and Create the &quot;Page on Demand&quot; Engine Object
'====================================================================================

On Error Resume Next
session(&quot;oRpt&quot;).ReadRecords
If Err.Number <> 0 Then
Response.Write &quot;An Error has occured on the server in attempting to access the data source&quot;
Else

If IsObject(session(&quot;oPageEngine&quot;)) Then
set session(&quot;oPageEngine&quot;) = nothing
End If
set session(&quot;oPageEngine&quot;) = session(&quot;oRpt&quot;).PageEngine
End If

' INSTANTIATE THE CRYSTAL REPORTS SMART VIEWER
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top