Re: question on cfloop

2013-03-01 Thread Russ Michaels
Perhaps it only happened with qiery loops then Regards Russ Michaels www.michaels.me.uk www.cfmldeveloper.com - Free CFML hosting for developers www.cfsearch.com - CF search engine On Mar 1, 2013 10:00 PM, "Adam Cameron" wrote: > > On 1 March 2013 12:45, Russ Michaels wrote: > > > > > Have don

Re: question on cfloop

2013-03-01 Thread Adam Cameron
On 1 March 2013 12:45, Russ Michaels wrote: > > Have done so many times, many years ago thus how.discovered the issues. > Unless it got fixed in current versions. > Sorry mate, you're just mistaken. I dunno how far back you want to go, but I ran this code on CFMX7: Before Within: #i# A

RE: question on cfloop

2013-03-01 Thread UXB
>> It's the way index-based loops work. I am afraid that the way you described is not the way they work. The condition is evaluated before the loop starts and only commences if the condition is met. So will not run at all. >> Do you ever manipulate somearray inside the loop? That should not

Re: question on cfloop

2013-03-01 Thread Russ Michaels
Have done so many times, many years ago thus how.discovered the issues. Unless it got fixed in current versions. Regards Russ Michaels www.michaels.me.uk www.cfmldeveloper.com - Free CFML hosting for developers www.cfsearch.com - CF search engine On Mar 1, 2013 12:36 PM, "Adam Cameron" wrote: >

Re: question on cfloop

2013-03-01 Thread Adam Cameron
Sure. But you *don't need to*. deals with it. -- Adam On 1 March 2013 12:38, Russ Michaels wrote: > > Also it is quite easy to test if the dynamic.value will be above zero. > > E.g > > > Do loop > > Do something else > > > Regards > Russ Michaels > www.michaels.me.uk > www.cfmldeveloper.c

Re: question on cfloop

2013-03-01 Thread Russ Michaels
Also it is quite easy to test if the dynamic.value will be above zero. E.g Do loop Do something else Regards Russ Michaels www.michaels.me.uk www.cfmldeveloper.com - Free CFML hosting for developers www.cfsearch.com - CF search engine On Mar 1, 2013 12:26 PM, "Adam Cameron" wrote: > > On 1

Re: question on cfloop

2013-03-01 Thread Adam Cameron
Just run the code & see, mate. On 1 March 2013 12:34, Russ Michaels wrote: > > Yes Adam it does, I had to change much code back in the day due to that > very issue. > ~| Order the Adobe Coldfusion Anthology now! http://www.am

Re: question on cfloop

2013-03-01 Thread Russ Michaels
Yes Adam it does, I had to change much code back in the day due to that very issue. Regards Russ Michaels www.michaels.me.uk www.cfmldeveloper.com - Free CFML hosting for developers www.cfsearch.com - CF search engine On Mar 1, 2013 12:26 PM, "Adam Cameron" wrote: > > On 1 March 2013 08:37, Rus

Re: question on cfloop

2013-03-01 Thread Adam Cameron
On 1 March 2013 08:37, Russ Michaels wrote: > > The.simple answer is, only use an index loop where there is more than 1 > iteration. It will always run once even if the loop is 0, because it has to > run once to find that out. > Nah, the condition is checked, but the code within the loop is not

Re: question on cfloop

2013-03-01 Thread Andrew Scott
Because your output is on the outside of the loop, therefore 2 is expected. That is not an indication your loop is running twice, and to confirm that you will need to put the output inside the loop and you will see a big difference. Regards, Andrew Scott WebSite: http://www.andyscott.id.au/ Goog

Re: question on cfloop

2013-03-01 Thread Russ Michaels
The.simple answer is, only use an index loop where there is more than 1 iteration. It will always run once even if the loop is 0, because it has to run once to find that out. I have never had an issue with an interation of 1 running twice though, that I have noticed anyway. Regards Russ Michaels

Re: question on cfloop

2013-02-28 Thread Adam Cameron
> > Do you ever manipulate somearray inside the loop? I am not sure if > #ArrayLen(somearray)# is evaluated once or at each looping. > The expressions passed to tags are evaluated first, then passed into the tag code. So in this case it's not the expression "arrayLen(someArray)" that's passed int

Re: question on cfloop

2013-02-28 Thread Adam Cameron
> I've never used the loop index, and I don't think you should depend on it. > Not sure what documented behavior is, but if it isn't documented in a > specific way, it would be totally appropriate for it to go out of scope in > a future version (kinda surprised it doesn't) > > Instead, use your ow

Re: question on cfloop

2013-02-28 Thread Adam Cameron
It's the way index-based loops work. At the first pass of the , the INDEX variable is created with the initial value, and the condition (in this case the condition is an implicit "index variable value <= TO value"). If the condition is true, the loop block is entered. At the bottom of the loop blo

Re: question on cfloop

2013-02-28 Thread Steve 'Cutter' Blades
for (var j = 1; local.j lte ArrayLen(local.somearray); local.j++) { WriteOutput(local.j); } Steve 'Cutter' Blades Adobe Community Professional Adobe Certified Expert Advanced Macromedia ColdFusion MX 7 Developer http://cutterscrossing.com Co-Author "Learning Ext JS 3.2" Packt

RE: question on cfloop

2013-02-28 Thread Dave Jemison
PM To: cf-talk Subject: Re: question on cfloop I am sorry, I wasn't clear. the "to" is arraylen. Sometimes the arraylen is 1 #j# --this returns 2 ~| Order the Adobe Coldfusion Anthology now! http:/

Re: question on cfloop

2013-02-28 Thread Billy Cravens
Not sure, but I believe the index at loop completion is incremented - that's how it knows how to stop. So it's similar to j=1; while(j<2) { j++; } I've never used the loop index, and I don't think you should depend on it. Not sure what documented behavior is, but if it isn't document

Re: question on cfloop

2013-02-28 Thread funand learning
I am sorry, I wasn't clear. the "to" is arraylen. Sometimes the arraylen is 1 #j# --this returns 2 On Thu, Feb 28, 2013 at 6:34 PM, Phillip Vector wrote: > > Why are you looping from 1 to 1? That isn't a loop. > > On Thu, Feb 28, 2013 at 7:22 PM, fun and learning > wrote: > > > > I

Re: question on cfloop

2013-02-28 Thread AJ Mercer
not on Railo 4 is this the whole script? is it in at Custom Tag? On 1 March 2013 08:22, fun and learning wrote: > > I have a query on looping in coldfusion.Why does the below loop run twice? > > >#j# > > > I thought the above code should return only 1, but it returns 1 2 > > ~~

Re: question on cfloop

2013-02-28 Thread Phillip Vector
Why are you looping from 1 to 1? That isn't a loop. On Thu, Feb 28, 2013 at 7:22 PM, fun and learning wrote: > > I have a query on looping in coldfusion.Why does the below loop run twice? > > >#j# > > > I thought the above code should return only 1, but it returns 1 2 > > ~~~