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

How to use the crviewer in Visual InterDev

Status
Not open for further replies.

DianaStewart

Programmer
Apr 16, 2002
58
0
0
CA
I am trying to use the CRVIEWER in Visual InterDev for the first time. I drop the crviewer onto my page. How can I indicate which report to place in the viewer? What is the syntax to get a report to show in the crviewer on my web page?

Help is greatly appreciated...

 
Maybe you can go to crystaldecision support websit and download some sample code from there which will guide you go through how to generate and view a report.

Cheers!

Ted
 
I just want to know what the syntax is for displaying a report in the actual crviewer... I checked the web site and found it confusing!!
 
Below is the exactly code to access a report object and view report. Hope it help

<%@ LANGUAGE=&quot;VBSCRIPT&quot; %>
<title></title>
<%
'=======================================================================
' WORKING WITH THE REPORT DESIGNER COMPONENT AND ASP TO PREVIEW A REPORT
'=======================================================================

reportname = &quot;logotest.rpt&quot;
' - 1 -
' 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

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

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

Response.Write Path & reportname

session(&quot;oApp&quot;).LogonServer &quot;PDSODBC.DLL&quot;, Cstr(&quot;GEMSquotetest&quot;), Cstr(&quot;REWARDS_SCALING&quot;), Cstr(&quot;RWDTSTS1&quot;), &quot;Scaling2002&quot;

Set session(&quot;oRpt&quot;) = session(&quot;oApp&quot;).OpenReport(path & &quot;\New reports\CLALogo\&quot; & reportname, 1)
'Session(&quot;oRpt&quot;).ParameterFields.GetItemByName(&quot;RTQNumber&quot;).AddCurrentValue(CStr(&quot;tedCORPRHOgq531&quot;))

'This Section suppress the subreport area dynamically
Dim RptSection
Dim supSection
Dim SectionOptions

'Get Report Section collection object
'Set RptSection = Session(&quot;oRpt&quot;).sections

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

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



%>
<HTML>
<HEAD>
<TITLE>Seagate ActiveX Viewer</TITLE>
</HEAD>
<BODY BGCOLOR=C6C6C6 LANGUAGE=VBScript ONLOAD=&quot;Page_Initialize&quot;>

<OBJECT ID=&quot;CRViewer&quot;
CLASSID=&quot;CLSID:C4847596-972C-11D0-9567-00A0C9273C2A&quot;
WIDTH=100% HEIGHT=95%
codebase=&quot;/viewer/activeXViewer/activexviewer.cab#Version=8,0,0,224&quot;>
<PARAM NAME=&quot;EnableRefreshButton&quot; VALUE=0>
<PARAM NAME=&quot;EnableGroupTree&quot; VALUE=1>
<PARAM NAME=&quot;DisplayGroupTree&quot; VALUE=1>
<PARAM NAME=&quot;EnablePrintButton&quot; VALUE=1>
<PARAM NAME=&quot;EnableExportButton&quot; VALUE=1>
<PARAM NAME=&quot;EnableDrillDown&quot; VALUE=1>
<PARAM NAME=&quot;EnableSearchControl&quot; VALUE=1>
<PARAM NAME=&quot;EnableAnimationControl&quot; VALUE=1>
<PARAM NAME=&quot;EnableZoomControl&quot; VALUE=1>
</OBJECT>

<SCRIPT LANGUAGE=&quot;VBScript&quot;>
<!--
Sub Page_Initialize
On Error Resume Next
Dim webBroker
Set webBroker = CreateObject(&quot;WebReportBroker.WebReportBroker&quot;)
if ScriptEngineMajorVersion < 2 then
window.alert &quot;IE 3.02 users on NT4 need to get the latest version of VBScript or install IE 4.01 SP1. IE 3.02 users on Win95 need DCOM95 and latest version of VBScript, or install IE 4.01 SP1. These files are available at Microsoft's web site.&quot;
CRViewer.ReportName = &quot;rptserver.asp&quot;
else
Dim webSource
Set webSource = CreateObject(&quot;WebReportSource.WebReportSource&quot;)
webSource.ReportSource = webBroker
webSource.URL = &quot;rptserver.asp&quot;
webSource.PromptOnRefresh = True
CRViewer.ReportSource = webSource
end if
CRViewer.ViewReport
End Sub
-->
</SCRIPT>
</BODY>
</HTML>


After you understand this. you need to integrate your own code to customize it base on user requirement.

Ted
 
I've been trying to learn about the relationship between asp and Crystal, but I've been kind of going around in circles. At this time we have Crystal Enterprise 8.0 Standard installed on our web server. I noticed that the script indicates the Report Designer Component. Would the script also be applicable if Crystal Enterprise is being used.?

Thanks very much.

Sue
 
sue,

Crystal report and Crystal enterprise are two different system. CR can allow you view the report; CE will provide you much more functionalities, i.e. role-base security, distribute report, management and report scheduling.

ASP page and script can't be integrated with Crystal enterprise. They have their own administration site in your webserver and they use crystal server page - csp page to access it. If you want to access report base on CE environment with customized requirement, either use their admin site or create your own csp page to do it

Hope it give you some sense.

Ted
 
Ted,

The CE we are using is Standard, not Professional, so it does not provide security. There are only 2 roles possible--one role is administrator, and 4 guests. I'm not quite sure what crystal server page is--could you explain it, or tell me where I could go go find out about it?

Thanks,

Sue
 
Hi,

I've found these examples in a couple of places. Thanks a lot, they're really helpful - what I'd like to know is if there is a reference for ASP as it relates to using the crviewer, i.e. the documentation for what all those options do, etc.

For instance, if this is an example, I'm looking for the actual manual on this stuff.

Thanks
 
Crystal server page defined by crystal decision is similar as ASP page. All the crystal enterprise functionalities are navigated by csp page. you can go to crystal support website and search csp and you may find lots of documents about it.

If you only need to view report, then you don't need to use it at all, it's really a pain to understand it.

Cheers !

Ted
 
Hi Malex,

Those sample code you can find from crystal support websit. there is an aspxmps85.exe there. I just combine them together with my own logic(not inside this sample). If you want to find reference for those, they don't have any SDK stuff, you need to find different documents base on your specific issues, but most of them you can find answer in crystal support website.

Even here, lots of guys can help you out. I learn a lot from this forum.

Hope it helps

Ted
 
The code is good and fine but I do not understand what is inside of WebBroker and also WebSource. Is the code available for the above objects ?

So if I have a Crystal Report calle Test.rpt...where do I load the report into the report object ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top