Or better yet here's an (untested) example: <cfset foundArray = arrayNew(1)> <cfloop list="#form.fieldNames#" index="x"> <cfset wasFound = false /> <cfloop from="1" to="#arrayLen(foundArray)#" index="y"> <cfif foundArray[y] EQ form[x]> <cfset wasFound = true /> </cfif> </cfloop> <cfif wasFound> <!--- logic to handle a duplicate found ---> <cfelse> <cfset ArrayAppend(foundArray,form[x])> </cfif> </cfloop>
On Thu, Oct 14, 2010 at 4:23 PM, Michael Grant <[email protected]> wrote: > 1. create an array to hold "found" values. > 2. loop through form.fieldnames > 3. for each form field loop through array of found values. if value found > inside found values array throw exception, if not add it to the array. > 4. if you make it to the end of the fieldnames loop you haven't found a > duplicate. > 5. profit. (should be step 3) > > > On Thu, Oct 14, 2010 at 4:17 PM, Robert Harrison < > [email protected]> wrote: > >> >> I have a list of 20 fields containing values from a form. Each field may >> or >> may not contain a string value, but no two fields may contain the same >> string. >> >> What would be the most efficient way to compare 20 fields to each other to >> ensure that, if they had a string, each field contains a unique string? >> >> >> Robert B. Harrison >> Director of Interactive Services >> Austin & Williams >> 125 Kennedy Drive, Suite 100 >> Hauppauge NY 11788 >> P : 631.231.6600 Ext. 119 >> F : 631.434.7022 >> http://www.austin-williams.com >> >> Great advertising can't be either/or. It must be &. >> >> Plug in to our blog: A&W Unplugged >> http://www.austin-williams.com/unplugged >> >> >> >> __________ Information from ESET Smart Security, version of virus >> signature >> database 5532 (20101014) __________ >> >> The message was checked by ESET Smart Security. >> >> http://www.eset.com >> >> >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:338207 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

