Solved

calling Crystal Report 8 from ASP

Posted on 2003-11-17
7
10,797 Views
Last Modified: 2007-12-19
Hello friends

I want to connect to Crystal reports 8 enterprise edition from ASP.HOw to connect it ?
My system already had  crystal reports 8.0. installed on it.Im using Windows 2000.In the start menu,on the Crystal report Tools menu, i have the crystal report web component manager.

Now do i have to do anything with that web component manager to make the report connected from ASP or only coding is required? If so pleasecan any one tell some coding know how ?

THis question i have asked in this forum in Crystal reports section but 8 months ago,that too on CR 8.5.But I could not oppurtunity to work on Crystal reports with ASP.
Is there any difference in the code in using Developer edition,Enterprise edition or professional edition

By the way can any one tell me what is CRViewer.Is it viewing the report in the browser?Tell me please if any one knows

Bare with me .I dont have much points.
Thanks and Regards
 RR.
0
Comment
Question by:RajaRajeswari
  • 3
  • 3
7 Comments
 
LVL 7

Accepted Solution

by:
Brad Dobyns, CSM earned 30 total points
ID: 9767919
0
 
LVL 7

Expert Comment

by:Brad Dobyns, CSM
ID: 9767930
Hmmm actually that is for version 9...try this:

http://support.crystaldecisions.com/communityCS/FilesAndUpdates/aspxmps8.exe.asp

Brad
0
 

Author Comment

by:RajaRajeswari
ID: 9769636
Hey Brad
Thanks really for ur nice link
But in that i found it bit difficult to understand.

I found the code to create a report in multiple pages. For example when i unzipped the exe file, there is one folder "Beginner' under which "Begin Here" folder is present.In that ,there is "SimplePreviewReport.asp" which explains clearly what to do.But the code is keeping on going in various pages(from what i have seen so far).I think we can put all those in a single page.But is this much code stuff you have to write a call a report(i hope you too have seen that zip file)?

Is there any way where i can write fewer steps to achieve this ?;in the process also i can get it memorized automatically in my mind too.Can u help me ?

But Credit to you for giving me a wonderful link.

Thanks and Regards
RR



 
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 3

Assisted Solution

by:rajuare
rajuare earned 20 total points
ID: 9769831
Hollo,

pls go thru the code for using crystal report in ASP



<%@ LANGUAGE="VBSCRIPT" %>

<%
'===========================================================================
' WORKING WITH THE REPORT DESIGNER COMPONENT AND ASP TO LOGON TO SUBREPORTS
'===========================================================================
'
' CONCEPT                                                            
'                                                                    
'  ALWAYS REQUIRED STEPS (contained in AlwaysRequiredSteps.asp)
'   - create the application object                                
'   - create the report object                                    
'   - open the report  
'
'  LOGGING ON TO SUBREPORTS
'   - create a reference to the main report object
'   - logon to the main report using setlogoninfo
'   - create a reference to the subreport object
'   - logon to the subreport using the setlogoninfo method
'        setlogoninfo "dsn/server name", "database name", "userid", "password"                                            
'
'  MORE ALWAYS REQUIRED STEPS (contained in MoreRequiredSteps.asp)
'   - retreive the records                                        
'   - create the page engine
'
'  DISPLAY THE REPORT
'   - display the report using a smart viewer
'==================================================================
%>

<%
' This line creates a string variable called reportname that we will use to pass
' the Crystal Report filename (.rpt file) to the OpenReport method contained in
' the AlwaysRequiredSteps.asp.

'reportname = "SubReportLogonExample.rpt"
'reportname = "buyer.rpt"
'reportname = "order.rpt"


'************* Input Date ***********************************

'=============> From Date <==================================

fromdate = trim(Request.Form("fromyear"))  & "/" & trim(Request.Form("frommonth")) & "/" & trim(Request.Form("fromday"))

'=============> To Date   <==================================

todate = trim(Request.Form("toyear"))  & "/" & trim(Request.Form("tomonth")) & "/" & trim(Request.Form("today"))

'************************************************************



if trim(request.querystring("status")) ="product" and trim(request.form("region")) = "USD" and trim(request.form("type")) = "Bar" then
      reportname = "product.rpt"
elseif trim(request.querystring("status")) ="product" and trim(request.form("region")) = "RS" and trim(request.form("type")) = "Bar" then
      reportname = "product1.rpt"
elseif trim(request.querystring("status")) ="product" and trim(request.form("region")) = "USD" and trim(request.form("type")) = "Pie" then
      reportname = "productusp.rpt"
elseif trim(request.querystring("status")) ="product" and trim(request.form("region")) = "RS" and trim(request.form("type")) = "Pie" then
      reportname = "productrsp.rpt"
elseif trim(request.querystring("status")) ="sales" and trim(request.form("region")) = "USD" and trim(request.form("type")) = "Bar" then
      reportname = "sales2.rpt"
elseif trim(request.querystring("status")) ="sales" and trim(request.form("region")) = "USD" and trim(request.form("type")) = "Pie" then
      reportname = "sales2.rpt"
elseif trim(request.querystring("status")) ="daily" and trim(request.form("region")) = "USD" and trim(request.form("type")) = "Bar" then
      reportname = "salesperson.rpt"
elseif trim(request.querystring("status")) ="Tot1" then
      reportname = "gpus.rpt"
elseif trim(request.querystring("status")) ="Tot2" then
      reportname = "gprs.rpt"
elseif trim(request.querystring("status")) ="PTot1" then
      reportname = "product.rpt"
      fromdate=trim(request.querystring("fdt"))
      todate=trim(request.querystring("tdt"))
elseif trim(request.querystring("status")) ="PTot2" then
      reportname = "product1.rpt"
      fromdate=trim(request.querystring("fdt"))
      todate=trim(request.querystring("tdt"))
end if


'response.write reportname & "<br>"
'response.write fromdate & "<br>"
'response.write todate & "<br>"

'response.end


%>

<%
'==================================================================
' ALWAYS REQUIRED STEPS
'
' Include the file AlwaysRequiredSteps.asp which contains the code    
' for steps:
'   - create the application object
'   - create the report object
'   - open the report
'==================================================================
%>                                                                    
<!-- #include file="AlwaysRequiredSteps.asp" -->                      

<%
'==================================================================
'        LOGGING ON TO SUB REPORTS USING SETLOGONINFO
'==================================================================


'Set the userid and password for your database.
'UserId = "your database user id"
UserId = "sa"

'Password = "your database password"
Password = "mypassword"

'Create a reference to the tables collection of the main report
Set mainReportTableCollection = Session("oRpt").Database.Tables

For Each Table in mainReportTableCollection
   'Table.SetLogonInfo "Pubs Sample Database", "pubs", CStr(Userid), CStr(Password)
      Table.SetLogonInfo "mspl", "intranet", CStr(Userid), CStr(Password)
Next


if trim(request.querystring("status")) ="product" then
      session("oRpt").RecordSelectionFormula = "{orderdetails.orderdate} in date('" & fromdate & "') to date('"  & todate & "') and {orderdetails.Currency} ='" & trim(request.form("region")) & "' and isnull({OrderDetails.Chargeback}) and isnull({OrderDetails.Adjusted}) and isnull({OrderDetails.Declined})"
elseif trim(request.querystring("status")) ="sales" then
      session("oRpt").RecordSelectionFormula = "{orderdetails.orderdate} in date('" & fromdate & "') to date('"  & todate & "') and {orderdetails.Currency} ='" & trim(request.form("region")) & "' and isnull({OrderDetails.Chargeback}) and isnull({OrderDetails.Adjusted}) and isnull({OrderDetails.Declined})"
elseif trim(request.querystring("status")) ="daily" then
      session("oRpt").RecordSelectionFormula = "{orderdetails.orderdate} in date('" & fromdate & "') to date('"  & todate & "') and {orderdetails.Currency} ='" & trim(request.form("region")) & "' and isnull({OrderDetails.Chargeback}) and isnull({OrderDetails.Adjusted}) and isnull({OrderDetails.Declined})"
elseif trim(request.querystring("status")) ="PTot1" then
      session("oRpt").RecordSelectionFormula = "{orderdetails.orderdate} in date('" & fromdate & "') to date('"  & todate & "') and {orderdetails.Currency} ='USD' and isnull({OrderDetails.Chargeback}) and isnull({OrderDetails.Adjusted}) and isnull({OrderDetails.Declined})"
elseif trim(request.querystring("status")) ="PTot2" then
      session("oRpt").RecordSelectionFormula = "{orderdetails.orderdate} in date('" & fromdate & "') to date('"  & todate & "') and {orderdetails.Currency} ='RS' and isnull({OrderDetails.Chargeback}) and isnull({OrderDetails.Adjusted}) and isnull({OrderDetails.Declined})"
end if





'session("oRpt").RecordSelectionFormula = "{orderdetails.orderdate} in date('2002/05/01') to date('2002/02/02') and {orderdetails.Currency} ='RS'"
'session("oRpt").RecordSelectionFormula = date("{orderdetails.orderdate} >= '2001,10/10/2001' and {orderdetails.orderdate} <= '10/10/2001'")
'session("oRpt").RecordSelectionFormula = date("{orderdetails.orderdate} in currentdate ")

'Create a reference to the subreport object by opening the subreport
'by using its name as specified in the report designer.
Set subReportOne = session("oRpt").OpenSubReport("Titles")

Set subReportOneTablesCollection = subReportOne.Database.Tables

'Provide the logon credentials for the subreport
For Each Table in subReportOneTablesCollection
    Table.SetLogonInfo "Pubs Sample Database", "pubs", CStr(Userid), CStr(Password)
Next

'Create a reference to the subreport object by opening the subreport
'by using its name as specified in the report designer.
Set subReportTwo = session("oRpt").OpenSubReport("Publishers")

Set subReportTwoTablesCollection = subReportTwo.Database.Tables

'Provide the logon credentials for the subreport
For Each Table in subRerportTwoTablesCollection
    subReportTwo.SetLogonInfo "Pubs Sample Database", "pubs", CStr(Userid), CStr(Password)
Next
%>

<%
'==================================================================
'
'  MORE ALWAYS REQUIRED STEPS
'
'  Include the file MoreRequiredSteps.asp which contains the code
'  for the steps:
'   - retreive the records                                        
'   - create the page engine                                      
'   - create the smart viewer and point it to rptserver.asp
'
'==================================================================
%>
<!-- #include file="MoreRequiredSteps.asp" -->

<%
' INSTANTIATE THE REPORT VIEWER
'
'When using the Crystal Reports in an ASP environment, we use
'the same page-on-demand Report Viewers used with the Crystal Web Component Server.
'There are six Report Viewers:
'
'1.  Report Viewer for ActiveX
'2.  Report Viewer for Java using Browser JVM
'3.  Report Viewer for Standard HTML with Frames
'4.  Report Viewer for Standard HTML
'5.  Report Viewer for Java Using Java Plugin
'6.  Report Viewer for Netscape Plug-in (ActiveX)
'
'The Report Viewer that you use will based on the browser's display capablities.
'For Example, you would not want to instantiate one of the Java viewers if the browser
'did not support Java applets.  For purposes on this demo, we have chosen to
'define a viewer.  You can through code determine the support capabilities of
'the requesting browser.  However that functionality is inherent in the Crystal
'Reports RDC and is beyond the scope of this demonstration application.
'
'We have chosen to leverage the server side include functionality of ASP
'for simplicity sake.  So you can use the SmartViewer*.asp files to instantiate
'the smart viewer that you wish to send to the browser.  Simply replace the line
'below with the Smart Viewer asp file you wish to use.
'
'The choices are SmartViewerActiveX.asp, SmartViewerJava.asp, JavaPluginViewer.asp,
'ActiveXPluginViewer.asp. SmartViewerHTMLFrame.asp, and SmartViewerHTMLPAge.asp.
'Note that to use this include you must have the appropriate .asp file in the
'same virtual directory as the main ASP page.
'
'*NOTE* For SmartViewerHTMLFrame and SmartViewerHTMLPage, you must also have
'the files framepage.asp and toolbar.asp in your virtual directory.


'=============================================================================
'  DISPLAY THE REPORT
'   - display the report using a smart viewer
'
' Include one of the Smart Viewers.
'  - Report Viewer for ActiveX                  =   SmartViewerActiveX.asp
'  - Report Viewer for Java using Browser JVM      =   SmartViewerJAVA.asp
'  - Report Viewer for Standard HTML            =   SmartViewerHTMLPage.asp
'  - Report Viewer for Standard HTML w/ Frames      =   SmartViewerHTMLFrame.asp
'  - Report Viewer for Java Using Java Plugin      =   JavaPluginViewer.asp
'  - Report Viewer for Netscape Plug-in            =   ActiveXPluginViewer.asp
'=============================================================================
%>
<!-- #include file="SmartVieweractivex.asp" -->                    


0
 
LVL 7

Expert Comment

by:Brad Dobyns, CSM
ID: 9771175
Unfortunetly, there is no easy answer to this...and yes, the coding is long and rediculous. As shown above...

I do not own a copy of CR so I don't know all that is involved. However, as many times as I have seen people wanting help with CR and ASP, I can only imagine how tough it must be.

Brad
0
 

Author Comment

by:RajaRajeswari
ID: 9837398
Hello HOllo and Brad
THanks for your reply

Im giving the marks to Hollo for his super link.
Thanks to Brad also.

Thanks
RR
0
 

Author Comment

by:RajaRajeswari
ID: 9837426
oops
Hey Sorry Brad and Rajuare please split the points
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now