Solved

Removing duplicates from a ColdFusion list

Posted on 2011-09-06
4
302 Views
Last Modified: 2012-05-12
My variable qaEmails is list (with a ; delimiter) that may contain duplicates. It may look like this:

groulx@ttl.org; tfarris@ttl.org; mwelch@ttl.org; tfarris@ttl.org; mdm@ttl.org; bnelson@ttl.org; awetterberg@ttl.org; bnelson@ttl.org

I want to strip the duplicates out of the list. How would I do this?

Thanks!
0
Comment
Question by:traport
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 19

Accepted Solution

by:
Bhavesh Shah earned 500 total points
ID: 36488460
Hi,

This cane be done by this way.(You must be knowing)
But I'm assuming you having lots of data, for that there is another method too, in case if you using SQL Server 2005

Let us know if you need anything more...

- Bhavesh
<cfoutput>
<cfset mail = "groulx@ttl.org; tfarris@ttl.org; mwelch@ttl.org; tfarris@ttl.org; mdm@ttl.org; bnelson@ttl.org; awetterberg@ttl.org; bnelson@ttl.org">

<cfset new_mail = "">

<cfloop list="#mail#" index="m" delimiters=";">
<cfif listfind(new_mail, m, ";") eq 0>
	<cfset new_mail = ListAppend(new_mail,m,";")>
</cfif>
</cfloop>

mail - #mail#<br />
new mail - #new_mail#

</cfoutput>

Open in new window

0
 

Author Closing Comment

by:traport
ID: 36488494
Worked beautifully - thank you!
0
 
LVL 39

Expert Comment

by:gdemaria
ID: 36488662

Just in case two mails have different case settings, you may want to use listFindNoCase()  

 That would make   jSmith@gmail.com the same as jsmith@gmail.com

<cfif listfindNoCase(new_mail, m, ";") eq 0>
0
 
LVL 19

Expert Comment

by:Bhavesh Shah
ID: 36488776
Hey,


Thank you sir for your information. =)

- Bhavesh
0

Featured Post

The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
Recently while working on a project I got a very annoying cfdocument has no body error message. I had never seen this error before. So I checked the code. The code was pretty simple; it was Just showing me the cfdocumnt tag and inside that tag a …
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question