Welcome to Dream.In.Code
Click Here
Getting Help is Easy!

Join 118,866 Programmers for FREE! Ask your question and get quick answers from experts. There are 1,727 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



INDEX ISSUE

 
Reply to this topicStart new topic

INDEX ISSUE, Decrement the index for a cfloop

rhoisy
post 29 Nov, 2007 - 07:39 AM
Post #1


New D.I.C Head

*
Joined: 19 Nov, 2007
Posts: 5


My Contributions


During a cfloop, If a certain condition occurs I wat the decrement the index, the process appears to work, but the next loop start at what it would expect to be the next index.
<cfloop from="1" to= "#new_passwords#" index="j">
(code removed)
<cfif no_special_char EQ 0>
<cfset #j# = #j# - 1>
<cfdump var="#j#" > is the dropped J <P>
</cfif>
</cfloop>
User is offlineProfile CardPM

Go to the top of the page


skyhawk133
post 29 Nov, 2007 - 07:45 AM
Post #2


Head DIC Head

Group Icon
Joined: 17 Mar, 2001
Posts: 14,608



Thanked 39 times

Dream Kudos: 1650

Expert In: Web Development

My Contributions


You'll need to set a separate variable inside the loop that you increment/decrement. The index will be reset to the correct value after each iteration.
User is offlineProfile CardPM

Go to the top of the page

rhoisy
post 29 Nov, 2007 - 08:12 AM
Post #3


New D.I.C Head

*
Joined: 19 Nov, 2007
Posts: 5


My Contributions


QUOTE(skyhawk133 @ 29 Nov, 2007 - 09:45 AM) *

You'll need to set a separate variable inside the loop that you increment/decrement. The index will be reset to the correct value after each iteration.

I was afraid of that, and it make the job harder. O'well I'm new at ColdFusion, so every language has it's draw backs.
User is offlineProfile CardPM

Go to the top of the page

sansclue
post 29 Nov, 2007 - 04:58 PM
Post #4


D.I.C Head

**
Joined: 21 Nov, 2007
Posts: 88



Thanked 4 times
My Contributions


Another option is to use a condition loop instead of a for loop. That would allow you to modify the index.
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 10/13/08 02:00AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month