Re: Comparing two listvars and deleting dups
Check cflib.org there are 2 UDFs in there that will do this. Mike - Original Message - From: Den Melton [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Monday, July 28, 2003 12:40 PM Subject: Comparing two listvars and deleting dups How would I make one list that combines the elements of list1 that changed in list2? For example List1: State:FL, City:Jax, County:Duval, Zip:32246 List2: State:FL, City:Jax, County:St Johns, Zip:32259 Output: County:Duval changed to County:St Johns, Zip:32246 changed to Zip:32259 ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Comparing two listvars and deleting dups
Sorry, I read your post too fast.. the two UDFs will help you do what you are trying to do. - Original Message - From: Michael T. Tangorre [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Monday, July 28, 2003 12:40 PM Subject: Re: Comparing two listvars and deleting dups Check cflib.org there are 2 UDFs in there that will do this. Mike - Original Message - From: Den Melton [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Monday, July 28, 2003 12:40 PM Subject: Comparing two listvars and deleting dups How would I make one list that combines the elements of list1 that changed in list2? For example List1: State:FL, City:Jax, County:Duval, Zip:32246 List2: State:FL, City:Jax, County:St Johns, Zip:32259 Output: County:Duval changed to County:St Johns, Zip:32246 changed to Zip:32259 ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Comparing two listvars and deleting dups
This is probably bloated code, but it's the best I can do before lunch :) Marlon cfset List1=State:FL, City:Jax, County:Duval, Zip:32246 cfset List2=State:FL, City:Jax, County:St Johns, Zip:32259 cfset myStruct = structNew() cfloop list=#list1# delimiters=, index=li cfset myStruct[#listfirst(li,:)#] = listlast(li,:) /cfloop cfloop list=#list2# delimiters=, index=li cfset myStruct[#listfirst(li,:)#] = listlast(li,:) /cfloop cfset list3 = cfloop collection=#myStruct# item=li cfset list3 = listappend(list3,#li#:#myStruct[li]#,,) /cfloop cfdump var=#list3# -Original Message- From: Den Melton [mailto:[EMAIL PROTECTED] Sent: Monday, July 28, 2003 11:40 AM To: CF-Talk Subject: Comparing two listvars and deleting dups How would I make one list that combines the elements of list1 that changed in list2? For example List1: State:FL, City:Jax, County:Duval, Zip:32246 List2: State:FL, City:Jax, County:St Johns, Zip:32259 Output: County:Duval changed to County:St Johns, Zip:32246 changed to Zip:32259 ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Comparing two listvars and deleting dups
At 12:40 PM 7/28/2003 -0400, you wrote: How would I make one list that combines the elements of list1 that changed in list2? For example List1: State:FL, City:Jax, County:Duval, Zip:32246 List2: State:FL, City:Jax, County:St Johns, Zip:32259 Output: County:Duval changed to County:St Johns, Zip:32246 changed to Zip:32259 Will your two lists always consist of those same fields? State, City, County, Zip? If so, that'll make it easier... First, create a variable to hold your output comments, just a blank var. Do a loop from 1 to the length of either of those lists (i.e. ListLen(List1)). Since those lists are comma delimited, that'll be fine. Let's say you use the index var 'pos' on this loop. Then compare ListLast(ListGetAt(List1, pos), :) to ListLast(ListGetAt(List2, pos), :). Note we're using : as a delimeter for these mini-lists. If the two values different, then use ListAppend to append to your output variable list: ListGetAt(List1, pos) changed to ListGetAt(List2, pos) That should do it. --Scott ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Comparing two listvars and deleting dups
http://www.cflib.org/udf.cfm?ID=532 and http://www.cflib.org/udf.cfm?ID=533 === Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc Member of Team Macromedia Email: [EMAIL PROTECTED] Blog : www.camdenfamily.com/morpheus/blog Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Dowdell, Jason G [mailto:[EMAIL PROTECTED] Sent: Thursday, March 06, 2003 8:55 AM To: CF-Talk Subject: Comparing two listvars and deleting dups Anyone have code off the top of their head to delete duplicate values from 2 lists. Here's an example. I want to delete all of the list items in ListVar1 that appear in ListVar2 ListVar1 = a,b,c,d,e ListVar2 = c,e Any suggestions? ~Jason ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Comparing two listvars and deleting dups
i just emailed you off list a custom tag i wrote.. you should be able to modify it as needed. hth, mike -Original Message- From: Dowdell, Jason G [mailto:[EMAIL PROTECTED] Sent: Thursday, March 06, 2003 9:55 AM To: CF-Talk Subject: Comparing two listvars and deleting dups Anyone have code off the top of their head to delete duplicate values from 2 lists. Here's an example. I want to delete all of the list items in ListVar1 that appear in ListVar2 ListVar1 = a,b,c,d,e ListVar2 = c,e Any suggestions? ~Jason ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Comparing two listvars and deleting dups
Anyone have code off the top of their head to delete duplicate values from 2 lists. Here's an example. I want to delete all of the list items in ListVar1 that appear in ListVar2 ListVar1 = a,b,c,d,e ListVar2 = c,e http://www.cflib.org/udf.cfm?ID=532 http://www.cflib.org/udf.cfm?ID=533 Regards, Dave. ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Comparing two listvars and deleting dups
Correct me if I'm wrong but that doesn't do what I'm asking. I want to remove all items in ListVar1 that appear in ListVar2. They are not already duplicated in ListVar1. ~Jason -Original Message- From: Raymond Camden [mailto:[EMAIL PROTECTED] Sent: Thursday, March 06, 2003 10:01 AM To: CF-Talk Subject: RE: Comparing two listvars and deleting dups http://www.cflib.org/udf.cfm?ID=532 and http://www.cflib.org/udf.cfm?ID=533 === Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc Member of Team Macromedia Email: [EMAIL PROTECTED] Blog : www.camdenfamily.com/morpheus/blog Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Dowdell, Jason G [mailto:[EMAIL PROTECTED] Sent: Thursday, March 06, 2003 8:55 AM To: CF-Talk Subject: Comparing two listvars and deleting dups Anyone have code off the top of their head to delete duplicate values from 2 lists. Here's an example. I want to delete all of the list items in ListVar1 that appear in ListVar2 ListVar1 = a,b,c,d,e ListVar2 = c,e Any suggestions? ~Jason ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Comparing two listvars and deleting dups
I remember seeing a tag on Macromedia's dev ex that did exaclty this. Sorry, I can't remember the name of it. - Original Message - From: Dowdell, Jason G [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 9:55 AM Subject: Comparing two listvars and deleting dups Anyone have code off the top of their head to delete duplicate values from 2 lists. Here's an example. I want to delete all of the list items in ListVar1 that appear in ListVar2 ListVar1 = a,b,c,d,e ListVar2 = c,e Any suggestions? ~Jason ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Comparing two listvars and deleting dups
cfset list1 = d,a,i,d,j,t,h,l,i,s,m,w,o,n,r,k cfset list2 = a,j,l,m,n cfoutput cfloop list=#list2# index=i cfset list1 = listdeleteat(list1, listfind(list1, i)) /cfloop #list1# /cfoutput - Original Message - From: Dowdell, Jason G [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 10:05 AM Subject: RE: Comparing two listvars and deleting dups Correct me if I'm wrong but that doesn't do what I'm asking. I want to remove all items in ListVar1 that appear in ListVar2. They are not already duplicated in ListVar1. ~Jason -Original Message- From: Raymond Camden [mailto:[EMAIL PROTECTED] Sent: Thursday, March 06, 2003 10:01 AM To: CF-Talk Subject: RE: Comparing two listvars and deleting dups http://www.cflib.org/udf.cfm?ID=532 and http://www.cflib.org/udf.cfm?ID=533 === Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc Member of Team Macromedia Email: [EMAIL PROTECTED] Blog : www.camdenfamily.com/morpheus/blog Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Dowdell, Jason G [mailto:[EMAIL PROTECTED] Sent: Thursday, March 06, 2003 8:55 AM To: CF-Talk Subject: Comparing two listvars and deleting dups Anyone have code off the top of their head to delete duplicate values from 2 lists. Here's an example. I want to delete all of the list items in ListVar1 that appear in ListVar2 ListVar1 = a,b,c,d,e ListVar2 = c,e Any suggestions? ~Jason ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Comparing two listvars and deleting dups
something like this should work cfloop list=listvar2 index=i delimiters=, cfif ListFind(listvar1, i, ,) cfset listvar1 = ListDeleteAt(listvar1, ListFind(listvar1, i, ,), ,) /cfif /cfloop At 10:05 AM 3/6/2003 -0500, you wrote: Correct me if I'm wrong but that doesn't do what I'm asking. I want to remove all items in ListVar1 that appear in ListVar2. They are not already duplicated in ListVar1. ~Jason -Original Message- From: Raymond Camden [mailto:[EMAIL PROTECTED] Sent: Thursday, March 06, 2003 10:01 AM To: CF-Talk Subject: RE: Comparing two listvars and deleting dups http://www.cflib.org/udf.cfm?ID=532 and http://www.cflib.org/udf.cfm?ID=533 === Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc Member of Team Macromedia Email: [EMAIL PROTECTED] Blog : www.camdenfamily.com/morpheus/blog Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Dowdell, Jason G [mailto:[EMAIL PROTECTED] Sent: Thursday, March 06, 2003 8:55 AM To: CF-Talk Subject: Comparing two listvars and deleting dups Anyone have code off the top of their head to delete duplicate values from 2 lists. Here's an example. I want to delete all of the list items in ListVar1 that appear in ListVar2 ListVar1 = a,b,c,d,e ListVar2 = c,e Any suggestions? ~Jason ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Comparing two listvars and deleting dups
want another one? : ) .it's a slow day heh cfset list1 = d,a,i,d,j,t,h,l,i,s,m,w,o,n,r,k cfset list2 = a,j,l,m,n cfoutput cfparam name=newlist default= cfloop list=#list1# index=i cfif NOT listfind(list2, i) cfset newlist = listappend(newlist, i) /cfif /cfloop #newlist# /cfoutput - Original Message - From: Dowdell, Jason G [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Thursday, March 06, 2003 10:05 AM Subject: RE: Comparing two listvars and deleting dups Correct me if I'm wrong but that doesn't do what I'm asking. I want to remove all items in ListVar1 that appear in ListVar2. They are not already duplicated in ListVar1. ~Jason -Original Message- From: Raymond Camden [mailto:[EMAIL PROTECTED] Sent: Thursday, March 06, 2003 10:01 AM To: CF-Talk Subject: RE: Comparing two listvars and deleting dups http://www.cflib.org/udf.cfm?ID=532 and http://www.cflib.org/udf.cfm?ID=533 === Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc Member of Team Macromedia Email: [EMAIL PROTECTED] Blog : www.camdenfamily.com/morpheus/blog Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Dowdell, Jason G [mailto:[EMAIL PROTECTED] Sent: Thursday, March 06, 2003 8:55 AM To: CF-Talk Subject: Comparing two listvars and deleting dups Anyone have code off the top of their head to delete duplicate values from 2 lists. Here's an example. I want to delete all of the list items in ListVar1 that appear in ListVar2 ListVar1 = a,b,c,d,e ListVar2 = c,e Any suggestions? ~Jason ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Comparing two listvars and deleting dups
We have a UDF close to that - ListCompare - Compares one list against another to find the elements in the first list that don't exist in the second list. Performs the same funciton as the custom tag of the same name. However, I think you want this: function existsInList2(l1,l2) { var i = 1; var newList = l1; for(i=1; i lte listlen(l1); i=i+1) { if(listFind(l2,listGetAt(l1,i)) newList = listDeleteAt(newList,i); } return newList; } You would want to add support for dynamic delimiters of course. Several examples at cflib.org show how to do this. I wrote this _very_ quickly, so forgive any typos. You may also want to consider changing listFind to listFindNoCase if you don't care about case. (Or even easier, make it one more optional arg, and if you don't care, just ucase l1 and l2.) === Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc Member of Team Macromedia Email: [EMAIL PROTECTED] Blog : www.camdenfamily.com/morpheus/blog Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Dowdell, Jason G [mailto:[EMAIL PROTECTED] Sent: Thursday, March 06, 2003 9:06 AM To: CF-Talk Subject: RE: Comparing two listvars and deleting dups Correct me if I'm wrong but that doesn't do what I'm asking. I want to remove all items in ListVar1 that appear in ListVar2. They are not already duplicated in ListVar1. ~Jason -Original Message- From: Raymond Camden [mailto:[EMAIL PROTECTED] Sent: Thursday, March 06, 2003 10:01 AM To: CF-Talk Subject: RE: Comparing two listvars and deleting dups http://www.cflib.org/udf.cfm?ID=532 and http://www.cflib.org/udf.cfm?ID=533 == = Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc Member of Team Macromedia Email: [EMAIL PROTECTED] Blog : www.camdenfamily.com/morpheus/blog Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Dowdell, Jason G [mailto:[EMAIL PROTECTED] Sent: Thursday, March 06, 2003 8:55 AM To: CF-Talk Subject: Comparing two listvars and deleting dups Anyone have code off the top of their head to delete duplicate values from 2 lists. Here's an example. I want to delete all of the list items in ListVar1 that appear in ListVar2 ListVar1 = a,b,c,d,e ListVar2 = c,e Any suggestions? ~Jason ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Comparing two listvars and deleting dups
Here's the solution I came up with... thanks for everyone's help. Maybe this should be a UDF :) cfset CurrentlyActiveUsers = a,b,c,d,e cfset ExistingUsers = b,d cfoutput cfset newlist = CurrentlyActiveUsers cfloop list=#CurrentlyActiveUsers# index=x delimiters=, cfif ListContains(ExistingUsers, x, ,) cfset newlist = ListDeleteAt(newlist, ListFindNoCase(newlist, x, ,), ,) /cfif /cfloop CurrentlyActiveUsers: #CurrentlyActiveUsers#br ExistingUsers: #ExistingUsers#brbr Cleaned List: #newlist#br /cfoutput -Original Message- From: Dowdell, Jason G [mailto:[EMAIL PROTECTED] Sent: Thursday, March 06, 2003 10:06 AM To: CF-Talk Subject: RE: Comparing two listvars and deleting dups Correct me if I'm wrong but that doesn't do what I'm asking. I want to remove all items in ListVar1 that appear in ListVar2. They are not already duplicated in ListVar1. ~Jason -Original Message- From: Raymond Camden [mailto:[EMAIL PROTECTED] Sent: Thursday, March 06, 2003 10:01 AM To: CF-Talk Subject: RE: Comparing two listvars and deleting dups http://www.cflib.org/udf.cfm?ID=532 and http://www.cflib.org/udf.cfm?ID=533 === Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc Member of Team Macromedia Email: [EMAIL PROTECTED] Blog : www.camdenfamily.com/morpheus/blog Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Dowdell, Jason G [mailto:[EMAIL PROTECTED] Sent: Thursday, March 06, 2003 8:55 AM To: CF-Talk Subject: Comparing two listvars and deleting dups Anyone have code off the top of their head to delete duplicate values from 2 lists. Here's an example. I want to delete all of the list items in ListVar1 that appear in ListVar2 ListVar1 = a,b,c,d,e ListVar2 = c,e Any suggestions? ~Jason ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Comparing two listvars and deleting dups
Ack! No, do not use listContains. listContains will match partial entries. Ie, if your list is: ray,camden and you search for cam, listContains will return 2 while listFind will return 0. If your intent is to only match the item completely, use listFind (or listFindNoCase). === Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc Member of Team Macromedia Email: [EMAIL PROTECTED] Blog : www.camdenfamily.com/morpheus/blog Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Dowdell, Jason G [mailto:[EMAIL PROTECTED] Sent: Thursday, March 06, 2003 9:21 AM To: CF-Talk Subject: RE: Comparing two listvars and deleting dups Here's the solution I came up with... thanks for everyone's help. Maybe this should be a UDF :) cfset CurrentlyActiveUsers = a,b,c,d,e cfset ExistingUsers = b,d cfoutput cfset newlist = CurrentlyActiveUsers cfloop list=#CurrentlyActiveUsers# index=x delimiters=, cfif ListContains(ExistingUsers, x, ,) cfset newlist = ListDeleteAt(newlist, ListFindNoCase(newlist, x, ,), ,) /cfif /cfloop CurrentlyActiveUsers: #CurrentlyActiveUsers#br ExistingUsers: #ExistingUsers#brbr Cleaned List: #newlist#br /cfoutput -Original Message- From: Dowdell, Jason G [mailto:[EMAIL PROTECTED] Sent: Thursday, March 06, 2003 10:06 AM To: CF-Talk Subject: RE: Comparing two listvars and deleting dups Correct me if I'm wrong but that doesn't do what I'm asking. I want to remove all items in ListVar1 that appear in ListVar2. They are not already duplicated in ListVar1. ~Jason -Original Message- From: Raymond Camden [mailto:[EMAIL PROTECTED] Sent: Thursday, March 06, 2003 10:01 AM To: CF-Talk Subject: RE: Comparing two listvars and deleting dups http://www.cflib.org/udf.cfm?ID=532 and http://www.cflib.org/udf.cfm?ID=533 == = Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc Member of Team Macromedia Email: [EMAIL PROTECTED] Blog : www.camdenfamily.com/morpheus/blog Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Dowdell, Jason G [mailto:[EMAIL PROTECTED] Sent: Thursday, March 06, 2003 8:55 AM To: CF-Talk Subject: Comparing two listvars and deleting dups Anyone have code off the top of their head to delete duplicate values from 2 lists. Here's an example. I want to delete all of the list items in ListVar1 that appear in ListVar2 ListVar1 = a,b,c,d,e ListVar2 = c,e Any suggestions? ~Jason ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Comparing two listvars and deleting dups
Thanks for the tip. I changed it. I was actually unaware of that so thank you. ~Jason -Original Message- From: Raymond Camden [mailto:[EMAIL PROTECTED] Sent: Thursday, March 06, 2003 10:32 AM To: CF-Talk Subject: RE: Comparing two listvars and deleting dups Ack! No, do not use listContains. listContains will match partial entries. Ie, if your list is: ray,camden and you search for cam, listContains will return 2 while listFind will return 0. If your intent is to only match the item completely, use listFind (or listFindNoCase). === Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc Member of Team Macromedia Email: [EMAIL PROTECTED] Blog : www.camdenfamily.com/morpheus/blog Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Dowdell, Jason G [mailto:[EMAIL PROTECTED] Sent: Thursday, March 06, 2003 9:21 AM To: CF-Talk Subject: RE: Comparing two listvars and deleting dups Here's the solution I came up with... thanks for everyone's help. Maybe this should be a UDF :) cfset CurrentlyActiveUsers = a,b,c,d,e cfset ExistingUsers = b,d cfoutput cfset newlist = CurrentlyActiveUsers cfloop list=#CurrentlyActiveUsers# index=x delimiters=, cfif ListContains(ExistingUsers, x, ,) cfset newlist = ListDeleteAt(newlist, ListFindNoCase(newlist, x, ,), ,) /cfif /cfloop CurrentlyActiveUsers: #CurrentlyActiveUsers#br ExistingUsers: #ExistingUsers#brbr Cleaned List: #newlist#br /cfoutput -Original Message- From: Dowdell, Jason G [mailto:[EMAIL PROTECTED] Sent: Thursday, March 06, 2003 10:06 AM To: CF-Talk Subject: RE: Comparing two listvars and deleting dups Correct me if I'm wrong but that doesn't do what I'm asking. I want to remove all items in ListVar1 that appear in ListVar2. They are not already duplicated in ListVar1. ~Jason -Original Message- From: Raymond Camden [mailto:[EMAIL PROTECTED] Sent: Thursday, March 06, 2003 10:01 AM To: CF-Talk Subject: RE: Comparing two listvars and deleting dups http://www.cflib.org/udf.cfm?ID=532 and http://www.cflib.org/udf.cfm?ID=533 == = Raymond Camden, ColdFusion Jedi Master for Mindseye, Inc Member of Team Macromedia Email: [EMAIL PROTECTED] Blog : www.camdenfamily.com/morpheus/blog Yahoo IM : morpheus My ally is the Force, and a powerful ally it is. - Yoda -Original Message- From: Dowdell, Jason G [mailto:[EMAIL PROTECTED] Sent: Thursday, March 06, 2003 8:55 AM To: CF-Talk Subject: Comparing two listvars and deleting dups Anyone have code off the top of their head to delete duplicate values from 2 lists. Here's an example. I want to delete all of the list items in ListVar1 that appear in ListVar2 ListVar1 = a,b,c,d,e ListVar2 = c,e Any suggestions? ~Jason ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4