[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1089
  • Last Modified:

Output Results to a Crystal Report

Hi All,

I am quite new to Coldfusion so please bear with me.

I have written a codfusion app that tracks our quotes going out to customers.  It is an Access MDB on a Windows 2000 box with Coldfusion (v5).  I have written the site in Dreamweaver.  I have Crystal Enterprise 10 installed on the box.

I want to achieve this - allow the users to view a Crystal Report through their web browser (as they will not have Crystal installed) to show, for example all Lost quotes for a region.  I.e. the link will show "Lost Quotes Report" which they will click on and the report will be displayed in the web browser.

I know my datasource etc, and it is not password protcted.  Can anyone give me a basic overview (step by step_ of how I can do this?

One other piece of info - I only have Crystal 9 for writing the reports, however I have ordered Crystal 11 which shoudl be here tomorrow.


  • 3
1 Solution
Hi sr_millar,

 Its actually very complicated... But here goes the basics.

 you need to createobject to a couple of com objects.

CrystalReports10.ObjectFactory.1 - Is the factory
CrystalReports.ReportAppSession - Is the ReportAppSession
and CrystalReports.ReportClientDocument - Is the client document.

open a connection to the com object for factory. the use something like this to get ReportAppSession

<cfset Factory = CreateObject("com","CrystalReports10.ObjectFactory.1")>
<cfset ReportApp = Factory.CreateObject("CrystalReports.ReportAppSession")>
<cfset ClientDoc = ReportApp.CreateService("CrystalReports.ReportClientDocument")>
<cfset pc = variables.o_Factory.CreateObject("CrystalReports10.CrystalPrintControl.1") />
<cfset getClientDoc().DatabaseController().Logon(this.Username, this.Password) />
<cfset o_PrintOutputController = getClientDoc().PrintOutputController() />
<cfset SetupParameters(Arguments.Parameters) /> <!--- Will explain this as its complicated --->
<cfset pc.DownloadHandler(variables.o_ClientDoc.ReportSource) />
<cfset pc.PrinterName(Arguments.Printer) />
<cfset pc.PrintReport() />

basically with the parameters ( I haven't done CF5.0 for a long time and this example is cf mx6.1 +)

                for (i=1; i lte ListLen(Arguments.parameters); i=i+1)
                    result = ListgetAt(Arguments.parameters,i);
                    ParamCollection = getClientDoc().DataDefinition().ParameterFields;
                    ParamToChange = ParamCollection.Item(i-1);
                    NewValue = GetFactory().CreateObject("CrystalReports.ParameterFieldDiscreteValue");
                    NewValue.Value = result;
                    TempParam = GetFactory().CreateObject("CrystalReports.ParameterField");
                    ParamToChange.CopyTo (TempParam);
                    ParamController = getClientDoc().DataDefController().ParameterFieldController();
                    ParamController.Modify (ParamToChange, TempParam);

Sorry that I am not much more use, but if you goto support.businessobjects.com they have a developer zone which might be able to help you more converting the above to Coldfusion 5.0


Don't worry about crystal 9 for writing the reports, Crystal 10 will still open crystal 9 written reports.

Oh forgot to say that you can export the report to a pdf then use cfcontent to display the pdf normally. If you like I can try to convert the code to cf 5.0 from mx6.1 at a cost if you like, but you will need to give me a few days to get it converetd and setup an example site for you to see it in action.

I'll leave it up to you.
sr_millarAuthor Commented:

I have managed to get my system to work using a product called ReCrystallize (www.recrystallize.com).  It seems to be doing everything I need it to.  Thank you for trying to help me though.

The question has been PAQ'd and the 500 points have been refunded.
Community Support Moderator

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now