| By Jeffry Houser | Article Rating: |
|
| November 7, 2006 01:00 PM EST | Reads: |
26,012 |
The StartTheTimer function starts by checking to see if the secs variable has counted down to zero yet. If it has, first it stops the clock. Then it checks to see if the form field has data in it. If the form field has data, submit the form. Otherwise, restart the clock.
If the time hasn't counted down to zero yet, subtract one from the counter, and set the function to execute again in one second. The function is recursive, calling itself. Load the page, and the timer waits, checking to see if something had been entered. Once it has, it submits the form, which does some further processing.
To start the ball rolling, you need to execute the InitializeTimer function, like this:
InitializeTimer();
As long as that is somewhere on the page, you're all set.
This example is a bit more simplified than what actually went into production (obviously since we didn't create a processing page). I did some Ajax-y stuff with iFrames to show a running status of what attendance was entered and when. Errors were also shown in the status list without interrupting future scans. It worked out well.
Friday: Graphing Types
I was sitting with a client
discussing a report. He wanted to view the report information in a
graphical format, so we had decided to implement this report using
cfchart. I made the mistake of asking if he would prefer a bar chart or
a pie chart. The client, being like normal clients, asked if I could do
both. It turns out I could.
There are three tags that are used to generate charts in ColdFusion: cfchart, cfchartseries, and cfchartdata. Cfchart defines overall attributes for graph, such as the format (PNG, JPG, or Flash), height, width, and other display attributes that affect the full chart. Full information is at the livedocs at http://livedocs.macromedia.com/coldfusion/7/htmldocs/00000226.htm#2619630. cfchartseries is used to define the chart style, such as bar or pie. There are eleven different types of charts supported. Full documentation on the tag is at http://livedocs.macromedia.com/coldfusion/7/htmldocs/00000228.htm#2741830. You can have multiple chart series inside a chart, but this tag must be nested inside a cfchart. cfchartdata is used to define a single point on the graph, and it is the simplest of the three tags, as it only defines the name of the point and its value. Cfchartdata must be located inside a cfchartseries. Its full documentation is located here: http://livedocs.macromedia.com/coldfusion/7/htmldocs/00000228.htm#2741830.
I didn't want to have to build multiple versions of the same report, one with a bar chart and one with a pie chart. I decided to pass the chart type as a URL variable into the template, and use that to decide what type of chart to display. This gives me the option of easily adding any of the 11 types supported by cfchart when the client asks for more in the future.
First I cfparamed a charttype variable to default it:
<cfparam name="chartType" default="pie">
That should cover me in the case of nothing being passed in. The next step was to get the data. I decided to use a query. In this example, I'll pull from my MyFriend's RSS Aggregator database and display the number of items for each RSS Feed:
<cfquery name="getTotals" datasource="#request.dsn#">
select RSSFeeds.title, count(Items.ItemID) as total
from RSSFeeds join items on (RSSFeeds.RSSFeedID = Items.RSSFeedID)
group by RSSFeeds.title
</cfquery>
And finally the page can display the chart like this:
<cfchart format="flash">
<cfchartseries itemcolumn="title" valuecolumn="total" query="getTotals" type="#chartType#" />
</cfchart>
Since the chart is getting data from a query, the cfchartdata tag is not needed. The cfchart, simply enough, tells us that we're creating a flash chart. I can load the page using URLs like this:
ChartTest.cfm?chartType=pie
ChartTest.cfm?chartType=bar
ChartTest.cfm?chartType=line
( and so on)
It was a simple, elegant solution that gave me another happy client.
Conclusion
It was a good week. I love dealing with
ColdFusion as a language because of the way it makes complicated
development tasks seem simple. I feel confident knowing that it will
help me address the next "crazy" idea. What are your favorite "odd"
requests you've had to deal with? How did you solve them? Just fill out
the contact form on my blog (www.jeffryhouser.com) and let me know!
Published November 7, 2006 Reads 26,012
Copyright © 2006 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Jeffry Houser
Jeffry is a technical entrepreneur with over 10 years of making the web work for you. Lately Jeffry has been cooped up in his cave building the first in a line of easy to use interface components for Flex Developers at www.flextras.com . He has a Computer Science degree from the days before business met the Internet and owns DotComIt, an Adobe Solutions Partner specializing in Rich Internet Applications. Jeffry is an Adobe Community Expert and produces The Flex Show, a podcast that includes expert interviews and screencast tutorials. Jeffry is also co-manager of the Hartford CT Adobe User Group, author of three ColdFusion books and over 30 articles, and has spoken at various events all over the US. In his spare time he is a musician, old school adventure game aficionado, and recording engineer. He also owns a Wii. You can read his blog at www.jeffryhouser.com, check out his podcast at www.theflexshow.com or check out his company at www.dot-com-it.com.
- Adobe’s Aiming ColdFusion at Multiple Clouds
- Cloud Computing Journal: Adobe to Deliver ColdFusion in the Cloud
- Adobe May Cooperate with Apple to Transplant Flash Player to iPhone
- Adobe Flex Developer Earns $100K in New York City
- Adobe LiveCycle Enterprise Suite 2 for Cloud Computing
- Adobe Betas Target RIAs and Cloud Computing
- Adobe Cans Another 9% of its Workforce
- Moyea DVD4Web Converter V2.0 Converts DVD to FLV Fast and Synchronously with Watermarks
- Adobe Fiddles with its Web Apps
- Adobe & Salesforce Cut Cloud Deal
- Hosting.com Launches ColdFusion 9 in the Cloud
- The Real Time Infrastructure Ultimatum
- Adobe’s Aiming ColdFusion at Multiple Clouds
- Eval JavaScript in a Global Context
- Fig Leaf Software to Exhibit at Government IT Conference & Expo
- Cloud Computing Journal: Adobe to Deliver ColdFusion in the Cloud
- Is Microsoft as Free as Open Source?
- Adobe Reader Sued
- The Planet Named “Bronze Sponsor” of Cloud Computing Expo
- Microsoft Expression Web Has Got Game
- Adobe May Cooperate with Apple to Transplant Flash Player to iPhone
- Adobe Flex Developer Earns $100K in New York City
- Bruce Chizen Joins Voyager Capital as Venture Partner
- My Top Seven Wishes From Adobe MAX 2009
- The Next Programming Models, RIAs and Composite Applications
- Where Are RIA Technologies Headed in 2008?
- Constructing an Application with Flash Forms from the Ground Up
- AJAX World RIA Conference & Expo Kicks Off in New York City
- CFEclipse: The Developer's IDE, Eclipse For ColdFusion
- Personal Branding Checklist
- Adobe Flex 2: Advanced DataGrid
- Has the Technology Bounceback Begun?
- Building a Zip Code Proximity Search with ColdFusion
- i-Technology Viewpoint: We Need Not More Frameworks, But Better Programmers
- The Asynchronous CFML Gateway
- Web Services Using ColdFusion and Apache CXF






























