CFREPORT  
Description

Used to do either of the following:

  • Execute a report definition created with the ColdFusion Report Builder, displaying it in PDF, FlashPaper, or Excel format. You can optionally save this report to a file.
  • Run a predefined Crystal Reports report. Applies only to Windows systems. Uses the CFCRYSTAL.exe file to generate reports. Sets parameters in the Crystal Reports engine according to its attribute values.
 
Category

Data output tags

 
Syntax
<!--- Syntax 1 - Use this syntax with the ColdFusion Report Builder. --->
<cfreport
      template = "report definition filename"
      format = "PDF or FlashPaper" or "excel"
      name = "cf variable"
      filename = "output filename"
      query = "query variable"
      overwrite = "yes" or "no"
      encryption = "128-bit" or "40-bit" or "none"
      ownerpassword = "password"
      userpassword = "password"
      permissions = "permission list"
>
      cfreportparam tags [optional]

</cfreport>
OR
<!--- Syntax 2 - Use this syntax with Crystal Reports. --->
<cfreport 
      report = "report_path"
      dataSource = "ds_name" 
      type = "type" 
      timeout = "number of seconds" 
      orderBy = "result_order"
      username = "username"
      password = "password"
      formula = "formula">
</cfreport>
 
See also

cfcollection, cfdocument, cfdocumentitem, cfdocumentsection, cfexecute, cfindex, cfobject, cfreportparam, cfsearch, cfwddx; Chapter 32, "Creating Reports for Printing," in ColdFusion MX Developer's Guide; Report Builder online Help

 
History

ColdFusion MX 7: Added support for the ColdFusion Report Builder.

ColdFusion MX: Changed data source connection behavior: Crystal Reports now establishes an independent connection to the data source. The connection is not subject to any ColdFusion data source-specific restrictions. For example, the Crystal Reports server can access a data source, regardless of whether it is disabled in the ColdFusion MX Administrator.

 
Usage

Use this tag to generate a report using a report definition created in either ColdFusion Report Builder or in Crystal Reports. (For more information on using the ColdFusion Report Builder, display the online help by opening the Report Builder and pressing F1.)

Note: The Excel report output format type provides limited support for the formatting options available in ColdFusion MX 7 Reporting. Images and charts are not supported and numeric data containing formatting (commas, percents, currency, and so on) appear as plain text in Excel. The Excel output format supports simple reports only and Macromedia recommends that you give careful design and layout consideration to reports designed for Excel output.

This tag requires an end tag.

 
Example
<!--- Example 1: This example shows the use of cfreport for the 
      ColdFusion Report Builder. --->
<cfquery name="northwindemployees" datasource="localnorthwind">
   SELECT EmployeeID, LastName, FirstName, Title, City, Region, Country
       FROM Employees
       ORDER BY Country, City
</cfquery>

<CFREPORT format="PDF" template="FifthReport.cfr" 
   query="#northwindemployees#" />

<!--- Example 2:
This view-only example shows the use of cfreport for Crystal Reports. --->
<h3>cfreport Tag<h3>
<p>cfreport lets reports from the Crystal Reports Professional report writer
display through a ColdFusion interface. To run, the tag requires the 
name of the report. cfreport can also pass information to the report 
file displayed, to change the output conditions.
<p>This example would run a report called "monthlysales.rpt " and pass it an
optional filter condition to show only the information for a subset 
of the report.

<cfreport report = '/reports/monthlysales.rpt'>
     {Departments.Department} = `International'
</cfreport>

<p>Substitute your report files and filters for this code. cfreport can put 
Crystal Reports into web pages.
TEMPLATE  
  Report Builder
 
  Req
 

Specifies the path to the report definition file, relative to the web root.

FORMAT  
  Report Builder
 
  Req
 

Specify one of the following:

  • PDF
  • FlashPaper
  • Excel
NAME  
  Report Builder
 
  Opt
 

The name of the ColdFusion variable that will hold the report output. You cannot specify both name and filename.

FILENAME  
  Report Builder
 
  Opt
 

The filename to contain the report. You cannot specify both name and filename.

QUERY  
  Report Builder
 
  Opt
 

The name of the query that contains input data for the report. If you omit this parameter, the report definition obtains data from the internal SQL or from cfreportparam items.

OVERWRITE  
  Report Builder
 
  Opt
 
Default value: "No"

Specifies whether to overwrite files that have the same name as that specified in the filename attribute. Specify Yes or No.

ENCRYPTION  
  Report Builder
 
  Opt
 
Default value: "None"

(format="PDF" only) Specifies whether the output is encrypted. Specify one of the following:

  • 128-bit
  • 40-bit
  • none
OWNERPASSWORD  
  Report Builder
 
  Opt
 

(format="PDF" only) Specifies an owner password.

USERPASSWORD  
  Report Builder
 
  Opt
 

(format="PDF" only) Specifies a user password.

PERMISSIONS  
  Report Builder
 
  Opt
 

(format="PDF" only) Specifies one or more of the following permissions:

  • AllowPrinting
  • AllowModifyContents
  • AllowCopy
  • AllowModifyAnnotations
  • AllowFillIn
  • AllowScreenReaders
  • AllowAssembly
  • AllowDegradedPrinting

Separate multiple permissions with a comma.

DATASOURCE  
  Crystal Reports
 
  Opt
 

Name of registered or native data source.

TYPE  
  Crystal Reports
 
  Opt
 
Default value: "standard"
  • standard (not valid for Crystal Reports 8.0)
  • netscape
  • microsoft
TIMEOUT  
  Crystal Reports
 
  Opt
 

Maximum time, in seconds, in which a connection must be made to a Crystal Reports file.

REPORT  
  Crystal Reports
 
  Required
 

Report path. Store Crystal Reports files in the same directories as ColdFusion page files.

ORDERBY  
  Crystal Reports
 
  Opt
 

Orders results according to your specifications.

USERNAME  
  Crystal Reports
 
  Opt
 

Username required for entry into database from which report is created. Overrides default settings for data source in ColdFusion MX Administrator.

PASSWORD  
  Crystal Reports
 
  Opt
 

Password that corresponds to username required for database access. Overrides default settings for data source in the ColdFusion Administrator.

FORMULA  
  Crystal Reports
 
  Opt
 

One or more named formulas. Terminate each formula with a semicolon. Use the format:

formula = "formulaname1 = 
'formula1';formulaname2 = 'formula2';"

If you use a semicolon in a formula, you must escape it by typing it twice (;;). For example:

formula = "Name1 = 'Val_1a;;Val_1b';Name2 = 
'Val2';"