The ListSort() function sorts the lists and puts them in the same order
and then the Compare() checks if the lists are the same.

Bernd VanSkiver
[EMAIL PROTECTED]
801.520.5957

-----Original Message-----
From: Greg Luce [mailto:[EMAIL PROTECTED]
Sent: Sunday, March 14, 2004 5:43 PM
To: CF-Talk
Subject: RE: Compare List

Brendan,
What would you use to for the sort order? These lists can be in
any order. Such as: 1,2,3,4,5 And 3,1,2,5,4

How would you compare these 2 lists using these functions?

Greg

-----Original Message-----
From: Brendan Avery [mailto:[EMAIL PROTECTED]
Sent: Sunday, March 14, 2004 5:29 PM
To: CF-Talk
Subject: RE: Compare List

Compare(ListSort(list1,"text"),ListSort(list2,"text")

Boo-yah.

== Brendan Avery -- http://www.brendanavery.com ==

-----Original Message-----
From: Greg Luce [mailto:[EMAIL PROTECTED]
Sent: Sunday, March 14, 2004 1:40 PM
To: CF-Talk
Subject: RE: Compare List

You're looking for a match where both lists contain the same values, but
possibly in different orders right? I would try:

<cfset state_list = "1,2,3,4,5,6,7,8">
<cfset query_list = "9,8,7,6,5,4,3,2">

<cfif listlen(state_list) EQ listlen(query_list)>
  <cfloop index="i" list="#state_list#">
    <cfif NOT listcontains(query_list, i)>
      Not A Complete Match<cfabort>
    </cfif>
  </cfloop>
  Lists Match
<cfelse>
  Not Same Length Match
</cfif>

Greg

-----Original Message-----
From: cfhelp [mailto:[EMAIL PROTECTED]
Sent: Sunday, March 14, 2004 2:13 PM
To: CF-Talk
Subject: Compare List

Will Compare(String1,String2) work to compare a list?

I have a Comma Delimited list of GUIDS (up to 50 for each state). That I
need to compare to a list GUIDS from a Query. If they match then return
true (1).

The GUIDS in the list may not be in the same order as the GUIDS from the
query.

Any ideas?

Rick

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.583 / Virus Database: 369 - Release Date: 2/10/2004
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to