How ColdFusion MX 7 Made Me a "Hero" at the Office...

Let me begin by saying that I don't consider myself a ColdFusion expert. In fact, I didn't even write my first ColdFusion application until 2004. Nevertheless, ColdFusion MX 7 still has made me a "hero" (as Simon would put it) at the office, and this is how it happened.

I am a Webmaster for the Air Protection Division, Environmental Protection Agency (EPA), Region 3, in Philadelphia. In June 2004 I wrote my first ColdFusion application in ColdFusion 5, which was the only version of the ColdFusion server available to me then. A Microsoft Access database served as the back end for this application. The application, which was deployed on my organization's intranet, was named the "Air Salient Issues ColdFusion Application (ASICA)." I know, I know, that's a very long, complicated name for a ColdFusion application, but this application's purpose was simple: store and facilitate access to my division's "salient issues." Salient issues are brief (one page) text descriptions of our most significant program activities, issues, events, and accomplishments. They are written by Region 3 employees on a weekly basis and are distributed, via e-mail, throughout the office to keep everyone (especially management) informed about the status of the work that's being done by every division, including the Air Protection Division (where I work).

The process of disseminating the salient issues to employees via e-mail was a very inefficient and cumbersome one. Worse, there was no way to search the salient issues to find a specific one when the need arose, and the need to search the salient issues arose quite often. The salient issues were written in Microsoft Word (or WordPerfect) and the documents were then placed into folders on a shared network drive. Therefore, if someone wanted to find a salient issue, they would have to manually search through the documents stored on the network. This was pretty much a hit or miss affair and, needless to say, very frustrating for employees. Consequently, most employees quickly forgot about their salient issues once they had been written and "published" via e-mail. My supervisor (David Arnold) and I decided that there had to be a better way of storing, organizing, and disseminating this information, so I began working on a ColdFusion application to do just that.

I built the ASICA as a standard "drill-down" search application in which users could search for salient issues by author, publication date, and/or keyword(s). To view or print the details of a salient issue, a user simply clicked on a link to load a "details" template that retrieved and displayed all of the pertinent information for that salient issue: Title, Publication Date, Summary, Author, Confidential Status, and Comments. A "Recent Salient Issues" page was deployed that listed the most recent salient issues published during the previous two weeks. This option was provided for managers who just wanted to get a quick listing of the most recent salient issues without having to perform a search.

I had no way of knowing this at the time, but the ASICA was destined to be the first in a succession of highly successful and well-regarded ColdFusion intranet applications that would place our most valuable and useful business information right at the fingertips of the people who needed it the most: our employees (all 1,000 of us).

As my programming skills and confidence grew, I became bolder with my code and began experimenting with new ColdFusion features and tags. Well, at least they were "new" to me since I was a beginning developer at the time. I implemented a "Next N Records" interface and query results caching to limit the amount of information displayed on each page and to increase performance. Due to budget constraints, I was stuck with Microsoft Access as the data source and therefore needed to minimize database interaction, otherwise, frequent database calls would affect the performance of the entire application. In the "Keyword Search" portion of the application, I employed <CFLOOP> and list variables to break apart multiple keywords entered by users performing searches; this code then scanned the Title and Summary fields of the database for a match on one or more of the keywords. This produced a surprisingly powerful and flexible search engine for my application that could easily handle multiple keywords and phrases. I also utilized the <CFCONTENT> tag to add a "print version" template to the application so that users could generate a Microsoft Word version of any salient issue. It strikes me as somewhat ironic that the "print version" feature produces a Word document since the proliferation of Word documents on our network drive and our inability to organize and manage them was the reason for developing this application in the first place.

The ASICA rapidly evolved into an indispensable information storage, search, and retrieval tool that could be used by anyone who knew their way around a Web browser. Of course, that included pretty much everyone in our office. New features and search capabilities were added and, eventually, word of the application's usefulness spread throughout the office. Today, the ASICA is used extensively for everything from determining the status of an enforcement case to highlighting an upcoming public outreach program. Another indication of the application's extraordinary success was upper management's regular use of the application and their willingness to provide me with the time and resources that I needed to build it and keep it running smoothly.

Soon after the success of the ASICA, I began receiving requests from other division managers to build similar applications for them so that they too could place their salient issues on the intranet and make them instantly accessible to everyone in the office. In response to these requests and to preserve my own sanity, I created a "generic" salient issues application with the help of some custom tags and user-defined functions (UDFs). This "generic" application could be customized for use by any division or program office, and could be deployed in a matter of minutes simply by resetting a few variables in the Application.cfm template, e.g., <CFSET divname = "Hazardous Site Cleanup Division"> and <CFSET datasource = "hscdsalients">. In other words, the only things different in these new "clone" applications were the division name, logo images, data source, and other information specific to the division for which the application was being created; all other code remained exactly the same as it had been for the ASICA. This strategy really paid off because it enabled me to create and deploy salient issues applications for other divisions in a matter of days instead of months. So, I learned from firsthand experience that they don't call ColdFusion a "Rapid Web Application Development" technology for nothing.

Three more salient issues applications followed the ASICA onto our agency intranet. I created, customized, and deployed each of these applications that would subsequently be used by other divisions. When these new applications were deployed on our intranet, the number of salient issues that we had made available online (via ColdFusion) doubled. Today, there are over 4,500 salient issues from four separate divisions available on our intranet, courtesy of ColdFusion MX 7.

With respect to data entry and application security, I used session variables and provided user names/passwords to authorized staff persons in each division to limit access to the administrative templates in each application. Every week, one or two authorized employees from each division enter their salient issues for that week into their respective database using the administrative templates. Since the text of the salient issues can be copied and pasted directly from the Microsoft Word (or WordPerfect) documents into the online ColdFusion forms, entering the weekly salient issues typically takes less than 20 minutes per application. Today, over 2,000 salient issues (dating back eight years) have been entered into the ASICA alone. As we have discovered for ourselves, 20 minutes of data entry time per week is a small price to pay for having mission-critical information online and organized so that it can be accessed by anyone in a matter of seconds. Indeed, I lost count of all the "thank you" e-mails that I had received from appreciative managers and staff who were finally able to find the exact information they were looking for simply by using one of my salient issues applications.


After the resounding (and somewhat unexpected) success of the salient issues applications, my next project was to build a ColdFusion application that would serve as a comprehensive inventory of clean diesel fuel projects in the U.S. This new application was named the "National Clean Diesel Database" (NCDD) and it has become an agency-wide intranet tool that EPA employees can access and use from any of our 10 regional offices (located in major cities throughout the U.S.) and headquarters. I used ColdFusion's <CFCHART> tag to generate attractive and informative bar and pie charts that neatly summarize the voluminous clean diesel project data (project cost, projected emission reductions, number of projects and vehicles per region, and so forth). I also used the <CFFUNCTION> tag to write UDFs that encapsulated redundant formatting and processing to further streamline my code and make it reusable. Some of the functions that I created while working on the NCDD were later used in my other ColdFusion applications. In the NCDD, I made frequent and effective use of the <CFOUTPUT> tag's "group" attribute to create grouped output of query results by region. I also used the "Query of Queries" feature to keep database interaction to an absolute minimum. I ended up receiving an award in 2005 for my work on the NCDD.

In early 2006 I added the <CFDOCUMENT> tag to my code arsenal so that users could easily retrieve "printable" (and portable) versions of application pages in Adobe Acrobat (PDF) format. I think the ability to dynamically render Web pages in PDF (or Flashpaper) format is one of the most exciting and truly useful new features in ColdFusion MX 7. In addition to being a tremendous time-saver, it has allowed me to accomplish certain things that would have otherwise been impossible. For example, I'm currently using the <CFSCHEDULE> and <CFDOCUMENT> tags to automatically publish static pages in both HTML and PDF format. PDF and/or HTML versions of Web documents published via our intranet can be moved to a public Web site that has no ColdFusion support. In other words, with ColdFusion MX 7 I am able to use an intranet application to generate documents for use on a static (non-ColdFusion) Web site. This is a critically important feature for me because having an actual ColdFusion application on my agency's public Web site is out of the question due to the high cost. The ability to produce static PDF (and HTML) documents from intranet database information for use on our public site is an effective, no-cost solution to this problem; this technique produces up to date, high-quality documents that can be deployed immediately on our public Web site. For examples of static Web documents that I have created using an intranet ColdFusion application, see www.epa.gov/reg3artd/permitting/permits1c.htm#lists and www.epa.gov/reg3artd/permitting/petitions2.htm.

Recently, while experimenting with some code, I found that I could use ColdFusion as a "JavaScript code generator." This technique takes the publication of static Web pages one step further by dynamically rendering JavaScript code in a browser; the code is then copied and pasted (by me) into static Web pages for use on the EPA's public Web site. Just as ColdFusion MX 7 can be used to create static HTML Web pages and PDFs, it can also be used to generate JavaScript code for use in static Web pages. One example of this technique is my division's "Title V Air Permits Search" Web page at www.epa.gov/reg3artd/permitting/t5permitsearch.htm. This is a standard HTML Web page with a twist: it utilizes an external JavaScript file (permitdata.js) that contains over 1,500 lines of JavaScript code. This JavaScript source code is effortlessly generated in seconds (by me) using a ColdFusion template on our intranet that queries our internal Air Permits Tracking System (Oracle) database and then renders, in the browser, all of the JavaScript code that's needed by the Title V Air Permits Search Web page. It's then a simple matter of copying and pasting the generated JavaScript from the browser to a text file and naming the file with a ".js" extension. I have also used UDFs to create dynamic JavaScript links (for lack of a better term) within ColdFusion pages that, when clicked, generate descriptive popup messages using the JavaScript "alert" method. These special popup message links are used throughout my ColdFusion applications to describe acronyms that appear on certain pages. These links make the applications much more user-friendly since users can click on them to quickly find out what the various acronyms mean.

Some things I'm working on for the future include the use of Flash forms for data entry; and the <CFHTTP>, <CFFILE> and <CFFTP> tags for file manipulation, uploads to our public Web server, and interaction with other federal government Web sites. I have also begun experimenting with the <CFTRY> and <CFCATCH> tags to catch and programmatically handle database errors when they occur in my applications. I've been using <CFMAIL> to send myself an e-mail whenever our database server encounters a problem; I have found this to be a very useful technique since I am notified immediately whenever the server goes down. I can then investigate and attempt to correct the problem.

By using ColdFusion MX 7, we have dramatically improved access to our most critical business information. With the salient issues applications, we transformed an archaic, inefficient business practice into a powerful data management tool that can be used by all Region 3 employees. Using ColdFusion MX 7, we were able to overcome Web publication obstacles that had prevented us from providing important environmental information to the public on the EPA Web site. I can't even imagine the exciting and productive things that we'll be doing with ColdFusion MX 7 (or Scorpio) a year or two from now. The future looks very bright indeed for ColdFusion developers, and I am glad to be a part of that future. By the way, what are these Event Gateway things I keep reading about in CFDJ? Maybe it's time to start experimenting with some code again...

© 2008 SYS-CON Media