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

unwanted report duplication within active x viewer

Status
Not open for further replies.

sjruss

Programmer
Nov 27, 2001
11
0
0
GB
i have a problem where my report displays it's self twice when viewed through the active x viewer using ie5.5 and CR v8. any ideas on how to resolve??
 
Does it display correctly from within Crystal?
How are you accessing it through the viewer?
Are you using VB or ASP or something else? Howard Hammerman,

Crystal Reports training, consulting, books, training material, software, and support. Scheduled training in 8 cities.
howard@hammerman.com
800-783-2269
 
it displays fine through the designer when previewed and i am using asp to call the viewer and a sql server 7 database
 
I suspect you have duplicated a line in your ASP code.
Can you post the relevant portions of the ASP? Howard Hammerman,

Crystal Reports training, consulting, books, training material, software, and support. Scheduled training in 8 cities.
howard@hammerman.com
800-783-2269
 
i doubt this is the problem bacause i use the same website to output another very similar form and i don't get the same problem. any other ideas??

do you think it could be the version of active x viewer that i am using activexviewer.cab#Version=8,0,0,224 ?
 
no, that sounds like a good version. Howard Hammerman,

Crystal Reports training, consulting, books, training material, software, and support. Scheduled training in 8 cities.
howard@hammerman.com
800-783-2269
 
here is the asp that does the call, it works fine for graduate but not for student.

-----------------------------------------------------------

Dim strReportName
Dim strSubReportName
Dim strUserid
Dim strPassword
Dim objCrtable
Dim colParams
Dim objCRSubreports
Dim objCrtablesub
Dim colParams2
Dim strP1
Dim strP2
Dim strSP1
Dim strServer
Dim strDatabase
Dim objApplication

'
' CONCEPT:
'
' This application is designed to demonstrate how to define a
' record selection formula at runtime. For this example the
' selection formula is "constructed" from information from
' the calling HTML page. However all you need to do to pass
' a valid Crystal Reports Selection Formula as a string.



'===================================================================================
'Create the Crystal Reports Objects
'===================================================================================
'
'You will notice that the Crystal Reports objects are scoped as session variables.
'This is because the page on demand processing is performed by a prewritten
'ASP page called "rptserver.asp". In order to allow rptserver.asp easy access
'to the Crystal Report objects, we scope them as session variables. That way
'any ASP page running in this session, including rptserver.asp, can use them.

strP2 = Request.QueryString("rpt")

if strP2 = 0 then
strReportname = "graduate.rpt"
elseif strP2 = 1 then
strReportname = "student.rpt"
end if

strSubReportname = "BatchSummary.rpt" ' Hard code subreport name


strP1 = Request.QueryString("batchID")
strSP1 = strP1 ' set subreport parameter to the same as that of the report

%>

<title> </title>

<%


'This line creates a string variable called reportname that we will use to pass
'the Crystal Report filename (.rpt file) to the OpenReport method.
'To re-use this code for your application you would change the name of the report
'so as to reference your report file.

' CREATE THE APPLICATION OBJECT
If Not IsObject (session(&quot;oApp&quot;)) Then
Set session(&quot;oApp&quot;) = Server.CreateObject(&quot;CrystalRuntime.Application&quot;)
End If

'This &quot;if/end if&quot; structure is used to create the Crystal Reports Application
'object only once per session. Creating the application object - session(&quot;oApp&quot;)
'loads the Crystal Report Design Component automation server (craxdrt32.dll) into memory.
'
'We create it as a session variable in order to use it for the duration of the
'ASP session. This is to elimainate the overhead of loading and unloading the
'craxdrt32.dll in and out of memory. Once the application object is created in
'memory for this session, you can run many reports without having to recreate it.

' CREATE THE REPORT OBJECT
'
'The Report object is created by calling the Application object's OpenReport method.

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

'This &quot;While/Wend&quot; loop is used to determine the physical path (eg: C:\) to the
'Crystal Report file by translating the URL virtual path (eg:
'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 & strReportname, 1)

'This line uses the &quot;PATH&quot; and &quot;reportname&quot; variables to reference the Crystal
'Report file, and open it up for processing.
'
'Notice that we do not create the report object only once. This is because
'within an ASP session, you may want to process more than one report. The
'rptserver.asp component will only process a report object named session(&quot;oRpt&quot;).
'Therefor, if you wish to process more than one report in an ASP session, you
'must open that report by creating a new session(&quot;oRpt&quot;) object.

session(&quot;oRpt&quot;).MorePrintEngineErrorMessages = False
session(&quot;oRpt&quot;).EnableParameterPrompting = False

'These lines disable the Error reporting mechanism included the built into the
'Crystal Report Design Component automation server (craxdrt32.dll).
'This is done for two reasons:
'1. The print engine is executed on the Web Server, so any error messages
' will be displayed there. If an error is reported on the web server, the
' print engine will stop processing and you application will &quot;hang&quot;.
'
'2. This ASP page and rptserver.asp have some error handling logic desinged
' to trap any non-fatal errors (such as failed database connectivity) and
' display them to the client browser.
'
'**IMPORTANT** Even though we disable the extended error messaging of the engine
'fatal errors can cause an error dialog to be displayed on the Web Server machine.
'For this reason we reccomend that you set the &quot;Allow Service to Interact with Desktop&quot;
'option on the &quot;World Wide Web Publishing&quot; service (IIS service). That way if your ASP
'application freezes you will be able to view the error dialog (if one is displayed).


set objCrtable = session(&quot;oRpt&quot;).Database.Tables.Item(1)
objCrtable.SetLogonInfo cstr(dbserver), cstr(dbname), cstr(dbuserid), cstr(dbpasswd)


' SET PROCEDURE PARAMETER
set colParams = Session(&quot;oRpt&quot;).ParameterFields
colParams.Item(1).SetCurrentValue (CLng(strP1))

'==================================================================
' SET LOGONINFO For SUBREPORT
'==================================================================
if not isempty (strSubReportName) Then
'open the subreport

Set objCRSubreports = session(&quot;oRpt&quot;).OpenSubreport(cstr(strSubReportName))

set colParams2 = objCRSubreports.ParameterFields
colParams2.Item(1).SetCurrentValue (Clng(strSP1))

'Set Subreport logon parameters for each table in the report.
set objCrtablesub = objCRSubreports.Database.Tables.Item(1)
objCrtablesub.SetLogonInfo cstr(dbserver), cstr(dbname), cstr(dbuserid), cstr(dbpasswd)
end if

'====================================================================================
' 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
'

%>
<!-- #include file=&quot;application.inc&quot; -->
<!-- #include file=&quot;crystal/SmartViewerActiveX1.asp&quot; -->
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top