I just want to echo, that I believe var'ing a struct at the top and then adding all variables to that struct is a good idea. It's what I do, though usually I do: var my = StructNew();... This is particularly handy when in CFCs when you even have to var your query names. Using this method all I have to do is proceed anything which is usually var'd with ".my" (or ".local"... whatever) and Shazam! it's var'd.
Cheers, Chris Leitch, Oblio wrote: > You must have all "var" variables at the top. My method is to "var > local=structNew()" at the top, and I can dynamically assign > "local.the_day=1" later on. > > Oblio > > > > -----Original Message----- > From: daniel kessler [mailto:[EMAIL PROTECTED] > Sent: Friday, February 02, 2007 10:58 AM > To: CF-Talk > Subject: error in cfscript > > I'm receiving an error that I don't understand: Local variable the_day > on line 10 must be grouped at the top of the function body. > > <cfscript> > > function makeDate(a_day,a_month,a_year,a_type){ > > var the_type = "begin"; > // this is before the other inits cause it's necessary for > year > if (a_type NEQ '' AND a_type NEQ undefined){ > the_type = a_type; > }; > var the_day = 1; > var the_month = 1; > var the_year = 1966; > if(the_type NEQ 'begin'){ > the_year = (year(now()))+10; > } > > if (a_day NEQ ''){the_day = a_day;}; > if (a_month NEQ ''){the_month = a_month;}; > if (a_year NEQ ''){the_year = a_year;}; > > return > CreateODBCDate(createDate(the_year,the_month,the_day)); > } > > </cfscript> > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:268482 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

