Re: Splitting a list...
>>lets say we have 650 elements in our list. >>split them into seperate lists with a maximun of 100 elements. I just showed you how to do it in the message you are replying to. The example will work on any list of any length. >>remember, each list must be in a variable Which variable? I could create dynamic variable names and put every list in it, but that would be kind of awkward. It is simpler to store them in a super list and retrieve any sublist whenever needed. ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:327182 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Splitting a list...
Would this work? http://cflib.org/udf/ListSplit -Original Message- From: Peter Boughton [mailto:bought...@gmail.com] Sent: Wednesday, October 14, 2009 5:33 AM To: cf-talk Subject: Re: Splitting a list... >lets say we have 650 elements in our list. >split them into seperate lists with a maximun of 100 elements. > >remember, each list must be in a variable ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:327176 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Splitting a list...
>lets say we have 650 elements in our list. >split them into seperate lists with a maximun of 100 elements. > >remember, each list must be in a variable Here we go - InputList will be your 650 elements. SegmentedLists is an array of the results. ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:327171 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Splitting a list...
lets say we have 650 elements in our list. split them into seperate lists with a maximun of 100 elements. remember, each list must be in a variable Sincerely, Chuka I.W. Anene Chief Software Eng./CEO Quorium Solutions www.quorium.org 07029609185,07032696113 From: Claude Schneegans To: cf-talk Sent: Tue, October 13, 2009 3:37:18 PM Subject: Re: Splitting a list... >>i need to have the values of each sublist in variables How about hving them in a list of lists? Then you could get each sublist pretty easily. Try this: Now you have a "|" delimited list of 100 elements "," delimited sublists Use listGetAt(theList, n, "|") to get each nth sublist. ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:327169 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Splitting a list...
>>i need to have the values of each sublist in variables How about hving them in a list of lists? Then you could get each sublist pretty easily. Try this: Now you have a "|" delimited list of 100 elements "," delimited sublists Use listGetAt(theList, n, "|") to get each nth sublist. ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:327116 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Splitting a list...
Not to forget, i need to have the values of each sublist in variables so i can use them. Your example does not allow that. Sincerely, Chuka I.W. Anene Chief Software Eng./CEO Quorium Solutions www.quorium.org 07029609185,07032696113 From: Mik Muller To: cf-talk Sent: Tue, October 13, 2009 4:32:12 AM Subject: Re: Splitting a list... At 06:43 PM 10/10/2009, you wrote: >>>> >> >>What would be the most efficient way to split the list into two lists, >> >>Try this : >> >> >> >> >> >>list1 = #list1# >>list2 = #list2# >> > > >I've been looking for this for long now. >What happens when you have a list containing coma-delimited numbers, say > >"1,2,3,4,X" > >Where "X" is a number below 5000. >How do you split this list into equal lengths of 100? This is an overly simple, inelligant, and inefficient method, but works nevertheless (in about a second). #now()# lists[#current#] = #lists[current]# #now()# This could easily be turned into a UDF with the 100 being an argument. Another way would be to whip through the original list character by character, counting the placement of commas at every hundredth mark and do a mid() each time. Mik Michael Muller Admin, MontagueMA.net Website ...a project of MontagueWebWorks.com mobile (413) 320-5336 http://www.MontagueMA.net Eschew Obfuscation ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:327111 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Splitting a list...
At 06:43 PM 10/10/2009, you wrote: >> >>What would be the most efficient way to split the list into two lists, >> >>Try this : >> >> >> >> >> >>list1 = #list1# >>list2 = #list2# >> > > >I've been looking for this for long now. >What happens when you have a list containing coma-delimited numbers, say > >"1,2,3,4,X" > >Where "X" is a number below 5000. >How do you split this list into equal lengths of 100? This is an overly simple, inelligant, and inefficient method, but works nevertheless (in about a second). #now()# lists[#current#] = #lists[current]# #now()# This could easily be turned into a UDF with the 100 being an argument. Another way would be to whip through the original list character by character, counting the placement of commas at every hundredth mark and do a mid() each time. Mik Michael Muller Admin, MontagueMA.net Website ...a project of MontagueWebWorks.com mobile (413) 320-5336 http://www.MontagueMA.net Eschew Obfuscation ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:327109 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Splitting a list...
>>>How do you split this list into equal lengths of 100? > >1. make a function to split the list into the first 100 elements and the >rest. >2. loop on the rest until its length is <= 100 could you help me setup a loop on that? mine is not working ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:327100 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Splitting a list...
>>How do you split this list into equal lengths of 100? 1. make a function to split the list into the first 100 elements and the rest. 2. loop on the rest until its length is <= 100 ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:327087 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Splitting a list of unknown amount
Totally untested and written on my phone, but it should be close: A = listToArray(yourList); Parts = []; while (arrayLen(a) gt 100) { ArrayAppend(parts, a.subList(0, 100)); A = a.subList(100, arrayLen(a)); } Dump(parts); Cheers, Barneyb -- Barney Boisvert bboisv...@gmail.com http://www.barneyb.com/ On Oct 10, 2009, at 3:47 PM, Chuka Anene wrote: > > I've been looking for this for long now. > What happens when you have a list containing coma-delimited numbers, > say > > "1,2,3,4,X" > > Where "X" is a number below 5000. > How do you split this list into equal lengths of 100? > > ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:327086 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Splitting a list...
>>> > >What would be the most efficient way to split the list into two lists, > >Try this : > > > > > >list1 = #list1# >list2 = #list2# > I've been looking for this for long now. What happens when you have a list containing coma-delimited numbers, say "1,2,3,4,X" Where "X" is a number below 5000. How do you split this list into equal lengths of 100? ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:327084 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Splitting a list...
>Thanks. I'm not sure if your method is quicker, but it allows me to break my >list wherever I need to. > > >> > >What would be the most efficient way to split the list into two lists, > >Try this : > > mid(theList, 1, st.len[1]-1)> )> >list1 = #list1# >list2 = #list2# > ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:327083 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Splitting a list...
>>The slashes here are not needed: Right, I had a problem while testing and I thought slashes were needed, but the problem was somewere else and I forgot to remove the slashes. ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:326959 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Splitting a list...
The slashes here are not needed: > This is fine: "([^,]*,){6}" ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:326957 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Splitting a list...
On Mon, Oct 5, 2009 at 12:00 PM, Claude Schneegans wrote: > > > I've never tried this before but perhaps you could make this more dynamic by doing something like this: Rick ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:326928 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Splitting a list...
>>I'm not sure if your method is quicker IMO, the longer is the list, the quicker it will be. ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:326906 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Splitting a list...
Thanks. I'm not sure if your method is quicker, but it allows me to break my list wherever I need to. -Original Message- From: Claude Schneegans [mailto:schneeg...@internetique.com] Sent: Monday, October 05, 2009 12:00 PM To: cf-talk Subject: Re: Splitting a list... >> What would be the most efficient way to split the list into two lists, Try this : list1 = #list1# list2 = #list2# ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:326905 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Splitting a list...
>> What would be the most efficient way to split the list into two lists, Try this : list1 = #list1# list2 = #list2# ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:326904 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4