Hi Ray. I'm still not clear about how to get this array in to a table. Can you show me how that's done?
Thanks, Lewis On Sat, May 18, 2013 at 2:37 PM, Lewis Billingsley < [email protected]> wrote: > > Many thanks, Ray. I'll plug this into the page with the DateFormat > changes etc., and see how it works. I really appreciate it. It's a step > up in learning for me. > > Lewis > > > On Sat, May 18, 2013 at 2:08 PM, Raymond Camden > <[email protected]>wrote: > >> >> This is virtually the same, with a bit less date and formatting, but >> written in tag syntax only. >> >> <cfset dates = arrayNew(1)> >> <cfset arrayAppend(dates, createDate(2013, 6, 10))> >> <cfset arrayAppend(dates, createDate(2013, 6, 11))> >> <cfset arrayAppend(dates, createDate(2013, 6, 14))> >> >> <cfdump var="dates"> >> >> <cfset newDates = arrayNew(1)> >> >> <cfloop index="x" from="1" to="#arrayLen(dates)#"> >> <cfif x is 1> >> <cfset newD = structNew()> >> <cfset newD.first = dates[1]> >> <cfset newD.last = dates[1]> >> <cfset arrayAppend(newDates, newD)> >> <cfcontinue> >> </cfif> >> >> <cfif dateDiff("d", newDates[arraylen(newDates)].last, dates[x]) is 1> >> <cfset newDates[arrayLen(newDates)].last = dates[x]> >> <cfelse> >> <cfset newD = structNew()> >> <cfset newD.first = dates[x]> >> <cfset newD.last = dates[x]> >> <cfset arrayAppend(newDates, newD)> >> </cfif> >> </cfloop> >> >> <cfdump var="#newdates#"> >> >> <cfloop index="x" from="1" to="#arrayLen(newDates)#"> >> >> <cfif newDates[x].first is newDates[x].last> >> <cfset newDates[x].formatted = dateFormat(newDates[x].first)> >> <cfelse> >> <cfset newDates[x].formatted = dateFormat(newDates[x].first) & " - " & >> dateFormat(newDates[x].last)> >> </cfif> >> </cfloop> >> >> <cfdump var="#newDates#"> >> >> >> >> On Sat, May 18, 2013 at 1:05 PM, Lewis Billingsley < >> [email protected]> wrote: >> >> > >> > I think I'm on version 9 >> > >> > >> > On Sat, May 18, 2013 at 2:01 PM, Raymond Camden < >> [email protected] >> > >wrote: >> > >> > > >> > > Hmm. So I'm guessing you are on an older version of CF. Let me >> rewrite it >> > > old school. >> > > >> > > >> > > On Sat, May 18, 2013 at 12:57 PM, Lewis Billingsley < >> > > [email protected]> wrote: >> > > >> > > > >> > > > I got this error: >> > > > Context validation error for the cfscript tag. >> > > > >> > > > Also, since I've got a somewhat steep learning curve here, it >> would >> > > > help a lot if you could let me know where how the similar places >> should >> > > > change. >> > > > >> > > > Thanks much, >> > > > Lewis >> > > > >> > > > >> > > > On Sat, May 18, 2013 at 1:26 PM, Raymond Camden < >> > [email protected] >> > > > >wrote: >> > > > >> > > > > >> > > > > Right, see my last email about converting the implicit notation >> into >> > > > > something simpler. >> > > > > >> > > > > >> > > > > On Sat, May 18, 2013 at 12:21 PM, Lewis Billingsley < >> > > > > [email protected]> wrote: >> > > > > >> > > > > > >> > > > > > I attached my file to one of your emails, but I think it didn't >> go >> > > > > through >> > > > > > because it had gone through cf-newbie. Here is my line 37: >> > > > > > >> > > > > > if(x == 1) { >> > > > > > arrayAppend(newDates, {first:dates[1],last:dates[1]}); >> > > > > > continue; >> > > > > > } >> > > > > > >> > > > > > >> > > > > > >> > > > > > On Sat, May 18, 2013 at 12:58 PM, Raymond Camden < >> > > > > [email protected] >> > > > > > >wrote: >> > > > > > >> > > > > > > >> > > > > > > What is your line 37? Mine is writeDump(var=newdates, >> label="New >> > > > > data"); >> > > > > > > >> > > > > > > I bet you mean this: >> > > > > > > >> > > > > > > arrayAppend(newDates, {first:dates[x], last:dates[x]}); >> > > > > > > >> > > > > > > if so, you may be on an older version of CF. I used implicit >> > > notation >> > > > > to >> > > > > > > define the structure. You can change it to this: >> > > > > > > >> > > > > > > newdateThing = structNew(); >> > > > > > > newdateThing.first = dates[x]; >> > > > > > > newdateThing.last = dates[x]; >> > > > > > > arrayAppend(newDates, newdateThing); >> > > > > > > >> > > > > > > Note you will need to make similar changes elsewhere. >> > > > > > > >> > > > > > > >> > > > > > > On Sat, May 18, 2013 at 11:29 AM, Lewis Billingsley < >> > > > > > > [email protected]> wrote: >> > > > > > > >> > > > > > > > >> > > > > > > > Hi Ray, >> > > > > > > > >> > > > > > > > I tried to run the code you sent, before trying to >> > understand >> > > > it. >> > > > > > Here >> > > > > > > > is the message I got: >> > > > > > > > >> > > > > > > > >> > > > > > > > - An expression beginning with arrayAppend, on line 37, >> > column >> > > > > > > > >> > > > > > > > Thanks, >> > > > > > > > Lewis >> > > > > > > > >> > > > > > > > >> > > > > > > -- >> > > > > > > >> > > > > > >> > > > > >> > > > >> > > >> > >> =========================================================================== >> > > > > > > Raymond Camden, Adobe Developer Evangelist >> > > > > > > >> > > > > > > Email : [email protected] >> > > > > > > Blog : www.raymondcamden.com >> > > > > > > Twitter: cfjedimaster >> > > > > > > >> > > > > > > >> > > > > > > >> > > > > > >> > > > > > >> > > > > >> > > > > >> > > > >> > > > >> > > >> > > >> > >> > >> >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:6068 Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-newbie/unsubscribe.cfm
