Author: Diego Benitez
Date: 3/10/05
CFM: Coldfusion MX 7

Here is the only that i have found to format date/time values coming from a database into the new flash forms on MX 7.

When using <cfformgroup type="repeater" query="queryname"> insted of <cfloop query="">
if avoids the server of compiling the swf file again. Saving sever time and just using a actionscript loop to populate the values throu remoteflash port so if you start guesing how to pull data from the query you have to use the atribute "bind"

Normally you call the value this way 
<cfformgroup type="repeater" query="queryname">
    <cfinput name=
"anyname" bind="{queryname.currentItem.yourtable}">
</cfformgroup>


insted of 
<cfloop query="queryname">
    <cfinput name=
"anyname" value="#queryname.yourtable#">
</cfloop>


So here for formatting your date/time use the following inside "bind" attribute

{queryname.currentItem.Updatedon.getMonth()}/{queryname.currentItem.Updatedon.getDate()}/{queryname.currentItem.Updatedon.getFullYear()} {((queryname.currentItem.Updatedon.getHours()%12) == 0) ? '12' : queryname.currentItem.Updatedon.getHours()}:{queryname.currentItem.Updatedon.getMinutes()} {(queryname.currentItem.Updatedon.getHours()<12) ? 'AM' : 'PM'}

Unfortunatelly ColdFusion doesn't let you create functions that can be compiled with the flash file so most of our statements have to be inside that line.
thats why all the line is long.

let brake down the code... lets take as example the month

{queryname.currentItem.Updatedon.getMonth()}

queryname = this will be your query name used on <cfquery name="">

currentitem = this tells flash that you are refering to the current row, basically this is the index.

updateon = is just a table that i created to hold the ODBCdatetime

getMonth() = this is a element of flash, if you want to go crazy using more of these get a flash MX book, i used the "FLASH MX Professional 2004 application development" or here is the online dictionary of flash
http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/index.html 

remember everything between {} is value, you use these insted of the ## for ColdFusion. Everything outside them is read as just text.

Good luck and if you find a better way to do this please let me know...

About This Tutorial
Author: Diego Benitez
Skill Level: Intermediate 
 
 
 
Platforms Tested: CFMX7
Total Views: 76,730
Submission Date: March 10, 2005
Last Update Date: June 05, 2009
All Tutorials By This Autor: 3
Discuss This Tutorial
  • nice

Advertisement


Website Designed and Developed by Pablo Varando.