YOUR FEEDBACK
Kirstan Vandersluis wrote: Great intro to SOA, Paul. You mention in the summary that budget cuts may stifl...


2008 East
DIAMOND SPONSOR:
Data Direct
Frontiers in Data Access: The Coming Wave in Data Services
PLATINUM SPONSORS:
Red Hat
The Opening of Virtualization
Intel
Virtualization – Path to Predictive Enterprise
Green Hills
IT Security in a Hostile World
JBoss / freedom oss
Practical SOA Approach
GOLD SPONSORS:
Software AG
The Art & Science of SOA: How Governance Enables Adoption
PlateSpin
Effective Planning for Virtual Infrastructure Growth
Fujitsu
Automated Business Process Discovery & Virtualization Service
Ceedo
Workspace Virtualization
Click For 2007 West
Event Webcasts

2008 East
PLATINUM SPONSORS:
Appcelerator
Think Fast: Accelerate AJAX Development with Appcelerator
GOLD SPONSORS:
DreamFace Interactive
The Ultimate Framework for Creating Personalized Web 2.0 Mashups
ICEsoft
AJAX and Social Computing for the Enterprise
Kaazing
Enterprise Comet: Real–Time, Real–Time, or Real–Time Web 2.0?
Nexaweb
Now Playing: Desktop Apps in the Browser!
Sun
jMaki as an AJAX Mashup Framework
POWER PANELS:
The Business Value
of RIAs
What Lies Beyond AJAX?
KEYNOTES:
Douglas Crockford
Can We Fix the Web?
Anthony Franco
2008: The Year of the RIA
Click For 2007 Event Webcasts
SYS-CON.TV
TODAY'S TOP SOA & WEBSERVICES LINKS


CFDJ Feature: Creating Subreports with the Report Builder in ColdFusion MX 7
With ColdFusion MX 7, you can use subreports to show more detailed reporting

With ColdFusion MX 7, you can use subreports to show more detailed reporting. A subreport is simply a report embedded or nested inside another report. I refer to the report that contains the subreport as the main report from this point forward. The subreport and main report are typically related by the nature of their content.

In this article on ColdFusion reporting, you'll learn a couple of techniques for linking a subreport to a main report. The focus will be placed on linking subreports using the ColdFusion Report Builder.

This article covers several key concepts used for linking subreports to main reports, including how to bind reports with parameters. I discuss two techniques on how to link subreports:

  • Linking an existing subreport to a main report
  • Creating a new subreport ad hoc and linking it to the main report
Having had the daunting task of supporting reporting applications through Java applets (and I barely survived that one!), I have come to appreciate the simplicity and ease of development that comes with the new reporting paradigm. I hope that after reading this article, you will also appreciate the power and rapid development that is now available with ColdFusion reporting in ColdFusion MX 7.

Requirements
ColdFusion MX 7.0.1
For a trial download: Trial Download To buy: To Buy

Note: If you have already installed ColdFusion MX 7, please install the ColdFusion 7.0.1 updater. Also install the ColdFusion sample applications that come with ColdFusion. If you have not installed the sample applications, run the ColdFusion installer again and select Sample Applications during the installation process.

ColdFusion Report Builder
ColdFusion Report Builder (EXE, 14.7 MB): www.macromedia.com/support/coldfusion/downloads_updates.html

Tutorials and Sample Files
http:download.macromedia.com/pub/developer/subreporting.zip

Prerequisite Knowledge
Recommended skills include a basic knowledge of ColdFusion and some reporting experience. However, this article will step through the sample subreport without assuming these skills. If you are new to ColdFusion reporting, please read "Building Reports with ColdFusion MX 7" by Collin Tobin and Dean Harmon (www.macromedia.com/devnet/coldfusion/articles/reporting.html).

ColdFusion Reporting
One common function of many companies is producing reports. There have been many software packages that offer these types of solutions, including Crystal Reports, Actuate, and Microsoft Access. Over time it has become more feasible and efficient to offer reporting through Web applications. Previously, ColdFusion offered Web reporting capabilities using the cfreport tag. With ColdFusion MX 7, however, developers have access to the new ColdFusion Report Builder to develop online reports.

The ColdFusion Report Builder tool is a separate software program included with ColdFusion MX 7 that integrates with your ColdFusion server for report development. When you use the ColdFusion Report Builder to create a report, it produces a separate file with a proprietary format, and extension of CFR. You refer to the filename in the template attribute of the cfreport tag. The cfreport tag has been available in ColdFusion for some time, but with ColdFusion MX 7 it has more functionality. You can configure the Report Builder to point to the Web root of your ColdFusion server for report previews. You can easily configure your report as FlashPaper, PDF, or an Excel spreadsheet.

The Subreport Component
Typically, the ColdFusion Report Builder is used to design reports embedded in a ColdFusion page. The ColdFusion Report Builder interface is similar to that of Macromedia Flash Professional 8. There are a variety of components available in the ColdFusion Report Builder tool, including a label and a field component, each of which has its own set of properties (see Figure 1). You can change these properties when you highlight a particular component or element of your report in the Property inspector. In this tutorial, you'll use a subreport component to link a main report to an existing subreport and link a main report to a new subreport.

You use the Subreport component to embed subreports in a main report. The next section describes how to bind the subreport to the main report using subreport parameters.

Binding Subreports to Main Reports with Parameters
Generally, you can link a subreport to a main report by passing a value from the query in the main report as a parameter to the subreport; this value filters data in the subreport query. You can link the reports through the Subreport Parameters property of the subreport component. Find this property in the Data category of the subreport properties (see Figure 2).

This property corresponds to the input parameters of the subreport. The name of this property must match the name of the input parameter of the subreport. The Subreport Parameters property is an expression usually mapped to a field of the query in the main report (see Figure 3). You can view this property by clicking the ellipsis in the lower right corner in Figure 2.

Linking a Report with an Existing Subreport
You can nest an existing report as a subreport inside another report. To do this, use the sample reports included in this tutorial named Department-Employees and Company-Departments. In this exercise, the Department-Employees report is the subreport.

This tutorial assumes that you have installed the sample applications with ColdFusion MX 7. You will be using the cfdocexamples data source, which points to the cfdocexamples database. If you have not installed the ColdFusion sample applications, run the ColdFusion installer again and select the option for installing the sample applications.

Once you have installed the sample applications, follow these steps to link the two existing reports:

  1. Copy Company-Departments.cfr report to a separate folder and rename it as Company-Departments_v1.cfr. Save a copy of the original report for the next exercise.
  2. Double-click the Company-Departments_v1.cfr report. This opens the ColdFusion Report Builder. If you have not installed the ColdFusion Report Builder, do so now.
  3. Expand the Detail band of the report to about 1.5 inches. You can do this by dragging the lower bounds of the Detail section or highlight the Detail section by clicking it and typing 1.5 as the Height property in the Property inspector.
  4. Click the Subreport component in the Toolbox (see Figure 1 again).
  5. Within the Detail band drag the cross hairs from upper left to lower right. You can resize this later as needed. The Subreport Wizard appears.
  6. Select the From an Existing Report option and click the ellipses to navigate to the Department-Employees.cfr report. Click Next.
  7. Because the sample subreport is already set up to take a parameter, the Subreport Wizard next asks you to bind the subreport parameters. For the DeptID, you can select from a pop-up list with the query's variables. Select query.Dept_ID from the pop-up list and click Next.
  8. Click Finish.
  9. Resize the Subreport component to see all the fields that the query will return. The width should be approximately 6.5 inches.
At this point, your report looks similar to Figure 4.

Save your report and preview it by pressing F12 or browse to the report. With a default ColdFusion installation, for example, it would be http://localhost:8500/subreports_example/ Company-Departments_v1.cfr.

Note: If you don't see a preview of your report when you press F12, select Edit > Preferences. Select Server Connection from the Preference Groups and modify the Server Information setting so that it points correctly to your ColdFusion server.

Creating and Linking a New Subreport to Your Report
You can also create your subreport on the fly instead of linking to an existing subreport. In this section, follow these steps to create and link to a new subreport:

  1. Copy Company-Departments.cfr report to a separate folder and rename it as Company-Departments_v2.cfr. Save a copy of the original report so you can use it for other tests. Double-click the Company-Departments_v2.cfr report. This opens the ColdFusion Report Builder. If you have not installed the ColdFusion Report Builder, do so now.
  2. Expand the Detail band of the report to about 1.5 inches. You can do this by dragging the lower bounds of the Detail section or highlight the Detail section by clicking Detail and type 1.5 as the Height property in the Property inspector.
  3. Click the Subreport component in the Toolbox (see Figure 1 again).
  4. Within the Detail band drag the cross hairs from upper left to lower right. You can resize this later as needed. The Subreport Wizard appears.
  5. Select the As a New Report option and click Next.
  6. Click the Query Builder button to create a query to retrieve your recordset. The Query Builder window appears.
  7. Select your ColdFusion server for RDS.

    Note: If you have not set up an RDS server, you will need to do so now. To do so, refer to the ColdFusion LiveDocs Documentation. Expand the available data sources for your ColdFusion server, expand the cfdocexamples data source, and click Tables to expand the table choices. Double-click the Employee table. The Employee table appears in the top portion of the Query Builder.

About Jim Bambrough
Jim Bambrough taught high school mathematics and computer programming in the Phoenix area for three years. Jim currently works as a Web application developer for Amkor Technology in Chandler, Arizona. He has worked in IT since 2000 and has been developing Web-based reports at the corporate level since 2003.

YOUR FEEDBACK
SYS-CON Italy News Desk wrote: With Adobe ColdFusion MX 7, you can use subreports to show more detailed reporting. A subreport is simply a report embedded or nested inside another report. I refer to the report that contains the subreport as the main report from this point forward. The subreport and main report are typically related by the nature of their content.
SYS-CON India News Desk wrote: With Adobe ColdFusion MX 7, you can use subreports to show more detailed reporting. A subreport is simply a report embedded or nested inside another report. I refer to the report that contains the subreport as the main report from this point forward. The subreport and main report are typically related by the nature of their content.
WEB 2.0 LATEST NEWS
Since Web 2.0 kicked off scarcely a day goes by without a headline targeting mashups and their enablers, AJAX and Web Services, as the next hot Web technologies. Mashups are Web sites that integrate a variety of services (e.g., news feeds, weather reports, maps, and traffic conditions)...
In this Exclusive Q&A with Jeremy Geelan of SYS-CON's Cloud Computing Journal, Rajeev Kutty of Keynote Systems speaks of the factors currently driving companies to increase their effort in monitoring the performance of their Web and mobile applications, and about how Keynote foresees a...
Industry blogger Alex Bunardzic writes in his 'Ethical Software by Alex Bunardzic' blog: 'Now that Microsoft has jumped onto the web 2.0 bandwagon, it is more than obvious that Web 2.0 is dead as a doornail. Everyone knows by now that anything Microsoft touches turns into this big slim...
'While the last decade was focused on the Web, the next phase in the evolution of our industry will be on the convergence of Web, mobile and desktop applications and the ability to extend existing applications with these new technologies for a consistent user experience regardless of h...
Join Scott Guthrie as he discusses Microsoft’s commitment to web standards development, Rich Internet Applications and how Microsoft is contributing to help move the web forward. Join Adobe’s Kevin Lynch as he demonstrates how Flash and HTML come together to make the most engaging,...
SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS
SUBSCRIBE TO OUR RSS FEEDS & GET YOUR SYS-CON NEWS LIVE!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021


SYS-CON FEATURED WHITEPAPERS

ADS BY GOOGLE