> Could some one please advise me how to compare two lists of Ids 
> (oldList, newList) and decide which Ids have been added or deleted (in 
> the newList compared to oldList) but ignore any item that are 
> unchanged? Many thanks, Kamru 

You might try this approach, taken from Rupesh Kumar's blog 
(http://coldfused.blogspot.com/2007/01/extend-cf-native-objects-harnessing.html).
 BTRW he's one of the Adobe engineers in India.

First convert both lists to arrays using the list to array function, then use 
the equals method that's a part of CFMX's java base, as in

<!--- convert your lists to arrays --->
<cfset array1 = ListToArray("1,2,3,4,5,6,7,8") />
<cfset array2 = ListToArray("2,3,4,5") />
<cfset array3 = ListToArray("1,2,3,4,5,6,7,8") />

<!--- Are the arrays equal? --->
<cfoutput>
   array1 equals array2 : #array1.equals(array2)#<br />
   array1 equals array3 : #array1.equals(array3)#<br />
</cfoutput>

Then to find out what items are different between two list you can use the 
removeAll method, as in:

<!--- Duplicate the first array we don't mess it up --->
<cfset dupArray1 = Duplicate(array1) /> 

<!--- Remove any common items between the two arrays (and lists)--->
<cfset dupArray1.removeAll(array2)> 

<!--- convert the array back to a list and report --->
Items in array1 not in array2: <cfoutput>#arrayToList(dupArray1)#

hth,
larry 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:308819
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to