Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding UNIQUE items in a list...

Status
Not open for further replies.

GregLanders

Programmer
Jul 9, 2001
17
US
What is the most efficient way to return a list of UNIQUE items from another list of items?
 
Perhaps looping over the list sorted adding values to a second list before adding values to the second list check if the list contains the value already if not add it if it does dont add it. If you're using cf5 there may already be a UDF to do this already on
HTH

KOla
 
This should do it,

<cfloop index=&quot;item&quot; list=&quot;list1&quot;>
<cfif ListContains(list2, item [, delimiters]) IS 0>
<!--- add item to second list --->
</cfif>
</cfloop>
success
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top