[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Compare two value lists and find ANY matches

Posted on 2006-06-22
3
Medium Priority
?
220 Views
Last Modified: 2013-12-24
What is the best way to compare two value lists and return TRUE if  ANY matches are found.  For instance...

Value List #1 = Item1, Item3, Item5, Item7
Value List #2 = Item2, Item3, Item4

should return TRUE since Item3 in in both lists.

Thanks.
0
Comment
Question by:SiriusPhil
[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
3 Comments
 
LVL 7

Expert Comment

by:aseusainc
ID: 16963115
<cfset List1 = "Item1,Item3,Item5,Item7">
<cfset List2 = "Item2,Item3,Item4">

<cfset match = 0>
<cfloop list = #list2# index = x>
<cfif listcontains(#list1#,#x#)>
  <cfset match = 1>
</cfif>
</cfloop>

<cfoutput>#match#</cfoutput>

0=no match, 1=match
0
 
LVL 7

Accepted Solution

by:
aseusainc earned 2000 total points
ID: 16963311
This may be better actually (use listfind instead of listcontains..my bad):

<cfset List1 = "Item1,Item3,Item5,Item7">
<cfset List2 = "Item2,Item3,Item4">

<cfset match = 0>
<cfloop list = #list2# index = x>
<cfif listfind(#list1#,#x#)>
  <cfset match = 1>
</cfif>
</cfloop>

<cfoutput>#match#</cfoutput>

0=no match, 1=match
0
 

Author Comment

by:SiriusPhil
ID: 16971967
Awsome.  Thanks.  I think I was just over engineering it.

Phil
0

Featured Post

Plesk WordPress Toolkit

Plesk's WordPress Toolkit allows server administrators, resellers and customers to manage their WordPress instances, enabling a variety of development workflows for WordPress admins of all skill levels, from beginners to pros.

See why 2/3 of Plesk servers use it.

Question has a verified solution.

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

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
Lease-to-own eliminates the expenditure of hardware replacement and allows you to pay off the server over time. Usually, this is much cheaper than leasing servers. Think of lease-to-own as credit without interest.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

650 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