Re: ColdFusion Looping

2014-04-24 Thread Byron Mann
OK, me==dah, the first 2 examples I just need to increment by 2 (or any other factor) other than 1. This is what happens without enough coffee. My actual code in use was like the 3rd example, but it is nested inside other loops. I had to break the inner loop in differing steps/increments. Somethi

Re: ColdFusion Looping

2014-04-24 Thread Andrew Scott
Yes Adam, you're right. I looked at the code quickly and saw the one increment and assumed *sigh* that it was using the for loop in the first example. Well in that case it is working as intended then. Regards, Andrew Scott WebSite: http://www.andyscott.id.au/ Google+: http://plus.google.com/1130

Re: ColdFusion Looping

2014-04-24 Thread Adam Cameron
> > The problem with cfscript is that it is more ESMAC compliant, which means > you can increment it when being used in a for loop as you have shown in > your last example. > Well yes and no. the CFScript construct: for(i=1; i<=10;i++){ // stuff } is not analogous to: It's analogo

Re: ColdFusion Looping

2014-04-24 Thread Andrew Scott
They are all working the way they are intended, but I will look at one in particular as it can catch a lot of people out. y=#y# When ColdFusion does any looping like this, the y is reset to the actual loop valuem hence making the manual increment mute. If you want it to step in lots of 2 then

Re: ColdFusion Looping

2014-04-24 Thread Adam Cameron
>Am i missing something obvious. > >y=#y# > > With this one, yes. With this sort of loop, CF maintains the counter internally, and just exposes its current value each iteration. So you can do what you like to the value inside the loop body, CF will simply expose the next incremented value eac

Re: ColdFusion Looping

2014-04-24 Thread Blake
maybe this? y=#y# On Thu, Apr 24, 2014 at 9:49 AM, Adam Cameron wrote: > > >Am i missing something obvious. > > [...] > >Only the last version is working as I would expect. I ran into this > >attempting to increment an index inside cfloop, so I could skip a few > >re

Re: ColdFusion Looping

2014-04-24 Thread Adam Cameron
>Am i missing something obvious. > [...] >Only the last version is working as I would expect. I ran into this >attempting to increment an index inside cfloop, so I could skip a few >records in an array. It's difficult to say how your expectations are off, given you don't *seem* to tell us what s

Re: ColdFusion Looping

2014-04-24 Thread Blake
t=#t# t=1 t=3 t=5 t=7 t=9 On Thu, Apr 24, 2014 at 9:39 AM, Byron Mann wrote: > > > #x#- > > > 1- 2- 3- 4- 5- 6- 7- 8- 9- 10- > > I would use step in cfloop, however, the increment can be variable from > iteration to iteration. > > > > > > Byron Mann > Lead

Re: ColdFusion Looping

2014-04-24 Thread Byron Mann
#x#- 1- 2- 3- 4- 5- 6- 7- 8- 9- 10- I would use step in cfloop, however, the increment can be variable from iteration to iteration. Byron Mann Lead Engineer & Architect HostMySite.com On Thu, Apr 24, 2014 at 12:32 PM, Blake wrote: > > You are only incrementing the earlier loops by on

Re: ColdFusion Looping

2014-04-24 Thread Blake
You are only incrementing the earlier loops by one. Why not do something like On Thu, Apr 24, 2014 at 9:28 AM, Byron Mann wrote: > > Yes, that last one with "x" is what I actually want. > > I'm just surprise the first few versions do not act in the same manner. > > Byron Mann > Lead Engineer

Re: ColdFusion Looping

2014-04-24 Thread Byron Mann
Yes, that last one with "x" is what I actually want. I'm just surprise the first few versions do not act in the same manner. Byron Mann Lead Engineer & Architect HostMySite.com On Thu, Apr 24, 2014 at 12:25 PM, Blake wrote: > > Looks like your incrementing X in the for statement and in the b

Re: ColdFusion Looping

2014-04-24 Thread Blake
Looks like your incrementing X in the for statement and in the body of the loop On Thu, Apr 24, 2014 at 8:55 AM, Byron Mann wrote: > > Am i missing something obvious. > > > > > > t=#t# > > > > > > > > w=#w# > > > > > > > > y=#y# > > > > > for(x=1; x <= 10; x++){ > > writeOut

ColdFusion Looping

2014-04-24 Thread Byron Mann
Am i missing something obvious. t=#t# w=#w# y=#y# for(x=1; x <= 10; x++){ writeOutput(x & ""); x++; } writeOutput(x); t=1 t=2 t=3 t=4 t=5 t=6 t=7 t=8 t=9 t=10 w=1 w=2 w=3 w=4 w=5 w=6 w=7 w=8 w=9 w=10 y=1 y=2 y=3 y=4 y=5 y=6 y=7 y=8 y=9 y=10 1 3 5 7 9 11 Only the last