:) absolutely right, thanks bobby!

>I meant assume TRUE to start of course
>
>
>.:.:.:.:.:.:.:.:.:.:.:.:.:.
>Bobby Hartsfield
>http://acoderslife.com
>http://cf4em.com
>
>
>
>Since they are all Booleans (judging from the way you referenced them) only
>one of them has to be false for the whole if to fail.
>
>So, assume false to start, then loop over each item until you either reach
>the end or one is false.
>
>Example... you have a, b, and c
>
>
><cfset a = true />
><cfset b = true />
><cfset c = true />
>
><cfset validate = true />
>
><cfloop list="a,b,c" index="i">
>       <cfif !variables[i]>
>               <cfset validate = false />
>               <cfbreak />
>       </cfif>
></cfloop>
>
><cfif validate>
>       Do whatever because all variables were true 
><cfelse>
>       Don't process because one or more variables was false 
></cfif>
>
>
>Running that should Result in "Do whatever because all were true"
>
>If you change any of the A, B or C vars to false at the top, the result
>should be "Don't process because one or more variables was false"
>
>
>If you wont know the a,b,c variables, then Id do what I could to put them
>into a unique structure then loop over that structure...
>
>For example...
>
><cfset varStruct = {} />
><cfset varStruct['a'] = true />
><cfset varStruct['b'] = true />
><cfset varStruct['c'] = true />
>
><cfset validate = true />
>
><cfloop collection="#varStruct#" item="i">
>       <cfif !varStruct[i]>
>               <cfset validate = false />
>               <cfbreak />
>       </cfif>
></cfloop>
>
><cfif validate>
>       Do whatever because all variables were true 
><cfelse>
>       Don't process because one or more variables was false 
></cfif>
>
>
>.:.:.:.:.:.:.:.:.:.:.:.:.:.
>Bobby Hartsfield
>http://acoderslife.com
>http://cf4em.com
>
>
>thanks bobby, yes i am also noticing evaluate runs slow as the processing
>increases.
>
>i like your example although how would i write the code if sometimes there
>are 3 variables, sometimes 4 etc... it almost seems to me there needs to be
>a loop inside the if statement, unless i am misunderstanding this?
>
>thanks 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:346184
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to