|
|
YOUR FEEDBACK
Did you read today's front page stories & breaking news?
SYS-CON.TV SYS-CON.TV WEBCASTS |
TOP COLDFUSION LINKS Flash Forms
Easy Flash Dashboards
Using CFMX-delivered dynamic data
By: Tim Burton
Mar. 15, 2006 06:00 PM
Digg This!
Dashboards are user interfaces that organize and present information intuitively, usually with graphical elements. The information is often aggregated from several sources (databases, operational metrics, log files, etc.) and summarized. They are often used by decision or policy makers.
As it's common practice to import corporate data into spreadsheets for presentation and decision-making purposes, CX's functionality is based upon Excel. Therefore, to build a CX dashboard you must create a spreadsheet containing the data tables (defined rows and columns) and cells that will ultimately be transformed into graphical "eye candy." After performing this step and saving the spreadsheet, the CX IDE is opened, a new project created, and the spreadsheet imported into the project; the latter can be thought of as embedded data structures. You now have the data; the next step is to construct charts, dials, sliders, and other components. Wizards then help you map the data to the component(s). The last step within the CX IDE compiles the dashboard into a Flash file (with suffix .swf), which can be sent to users via e-mail or deployed to a Web server for browser viewing. Let's look at an example. Figure 1 shows one tab of a dashboard containing six Flash components. Starting from the top right and viewing clockwise, notice:
In our example, the input combo box is configured to show a range of years that is mapped to a column of spreadsheet cells containing those year-values; its output (the year chosen by the user) is mapped to one of those spreadsheet cells. When the user hits the "Chart Selected Year" button, the value in that one cell is wrapped into an XML packet and sent to a ColdFusion action template that has been designated by a URL in the wizard. At the CF server, the XML packet is parsed and the value (the year in this case) is passed into a database query; data from a static file could, of course, be returned as well. The CF server then wraps the query resultset into an XML packet for return to the Flash file and subsequent display (see Listing 1). The XC IDE generates the entire structure of the XML packet for sending to and receiving from the CF server, thus simplifying the job of parsing the XML in code. Figure 1 shows four sections of CF code handling these back-end tasks. Section 1: The data passed in from the .swf is converted (by the CF server) into a struct with an extraneous name=value pair ("FIELDNAMES"), which is removed in this section. What remains is the #form# variable with only the original XML packet created by the .swf file. Section 2: To prevent the XML parser from throwing an error, the entire #form# variable is changed to lower case. Next, an XML tree object is created and the data (in this case, the year) is extracted. Section 3: The database is queried by a stored procedure call with the year passed in as the input parameter. Section 4: The returned cfquery is converted into an XML string for delivery back to the Flash file.
Workflow
Summary
CFDJ LATEST STORIES . . .
SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS SUBSCRIBE TO OUR RSS FEEDS & GET YOUR SYS-CON NEWS LIVE!
|
SYS-CON FEATURED WHITEPAPERS MOST READ THIS WEEK |
||||||||||||||||||||||||||||||||||||||||||||||||||||||