Alternating Rows with a Loop

I know you can use CurrentRow Mod x to count the rows from a query and thus set a variable to store a row colour.

I've just tried this for a loop but it doesn't work the same.

Is there different syntax or is it back to basics with a count variable?

This is the loop i'm using:

<cfloop index="idx" from="1" to="#ArrayLen(session.quoteStruct.Item)#">

Sorry i'm only giving this 40 points but these are my last 40 :'(

Thanks in advance for your help

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hi Chris,

CurrentRow only works if you are looping over queries.  Just use (idx mod 2) since you already have an incrementing index counter.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
chrissp26Author Commented:
Thanks again marcin :)

You won't hear anything from me for a while, I need to answer some questions in other areas to get my points back up.

Thanks again.


The Premium membership gives you unlimited points and is only US 9.95/month.  That is what I ended up getting... than as I found out, once you collect 10,000 points, you are offered a free Premium Membership as long as you maintain something like 3,000 points per month.

I initially got the Preium Membership because I figured that $9.95/month is nothing given the time I would save getting expert answers here.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.