RE: List Sort help
ListSort should work: http://www.cfquickdocs.com/cf8/#ListSort Although you might need to use the text sort instead of numeric. andy -Original Message- From: Tom Jones [mailto:tjo...@acworld.com] Sent: Wednesday, September 22, 2010 11:18 AM To: cf-talk Subject: List Sort help Hello, I have a lit of version numbers and I need to sort them in the right order. cfset appVers = 3.6.1,3.6.5,3.6.3,3.6.10 How do I sort these so that they show in the right order starting with the highest first? Thanks, tom ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337322 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: List Sort help
thanks, but I get an error saying cant convert 3.6.1 to numeric. tom ListSort should work: http://www.cfquickdocs.com/cf8/#ListSort Although you might need to use the text sort instead of numeric. andy Hello, I have a lit of version numbers and I need to sort them in the right order. cfset appVers = 3.6.1,3.6.5,3.6.3,3.6.10 How do I sort these so that they show in the right order starting with the highest first? Thanks, tom ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337323 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: List Sort help
Did you do this: Although you might need to use the text sort instead of numeric - Gabriel On Wed, Sep 22, 2010 at 12:26 PM, Tom Jones tjo...@acworld.com wrote: thanks, but I get an error saying cant convert 3.6.1 to numeric. tom ListSort should work: http://www.cfquickdocs.com/cf8/#ListSort Although you might need to use the text sort instead of numeric. andy Hello, I have a lit of version numbers and I need to sort them in the right order. cfset appVers = 3.6.1,3.6.5,3.6.3,3.6.10 How do I sort these so that they show in the right order starting with the highest first? Thanks, tom ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337324 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: List Sort help
What version of CF? On CF9, the following works: cfset appVers = 3.6.1,3.6.5,3.6.3,3.6.10 cfoutput#appVers#br /#listSort( appVers, 'numeric', 'desc' )#/cfoutput On Wed, Sep 22, 2010 at 9:26 AM, Tom Jones tjo...@acworld.com wrote: thanks, but I get an error saying cant convert 3.6.1 to numeric. tom ListSort should work: http://www.cfquickdocs.com/cf8/#ListSort Although you might need to use the text sort instead of numeric. andy Hello, I have a lit of version numbers and I need to sort them in the right order. cfset appVers = 3.6.1,3.6.5,3.6.3,3.6.10 How do I sort these so that they show in the right order starting with the highest first? Thanks, tom ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337325 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: List Sort help
Hmm, OK ... I'm using CFMX7 and OpenBD 1.3 Thanks, tom What version of CF? On CF9, the following works: cfset appVers = 3.6.1,3.6.5,3.6.3,3.6.10 cfoutput#appVers#br /#listSort( appVers, 'numeric', 'desc' )#/cfoutput ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337326 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: List Sort help
Correction, it's only on OpenBD 1.3, that I have the problem. I will file a bug with them. Thanks, tom Hmm, OK ... I'm using CFMX7 and OpenBD 1.3 Thanks, tom ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337329 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: List Sort help
On CF9, the following works: Does it *really* work .. or just seem to? I cannot test it at the moment, but I would not have expected either sort to yield the desired results. -Leigh ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337340 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: List Sort help
On Wed, Sep 22, 2010 at 2:25 PM, Leigh cfsearch...@yahoo.com wrote: On CF9, the following works: Does it *really* work .. or just seem to? I cannot test it at the moment, but I would not have expected either sort to yield the desired results. What would be the difference between *really* working and just seeming to? I output the listSorted()'d values, they looked to be sorted. So it seems to. As to whether or not it *really* works, I will admit that I hadn't had a full cup of coffee when testing. But I agree with you... I was more surprised that it seemed to have worked than I would have been had it not. FWIW, sorting by text did not work. Well, it worked as one might have expected it to (putting 3.6.10 and 3.6.1 next to each other), but not in the way that the OP was looking for it to work. -- Charlie Griefer http://charlie.griefer.com/ I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337341 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: List Sort help
What would be the difference between *really* working and just seeming to? For me ... more testing and more coffee ;-) Specifically with a greater range of values, such as version numbers before and after the 3.x.x range. I was more surprised that it seemed to have worked than I would have Exactly, and that is why I am suspicious. I was not expecting text to work at all, for obvious reasons. Neither was I expecting numeric to work because values like 3.6.1 are not numeric. At least not in the strict sense. Hence my reluctance to say it it works -Leigh ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337342 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: List Sort help
On Wed, Sep 22, 2010 at 3:16 PM, Leigh cfsearch...@yahoo.com wrote: What would be the difference between *really* working and just seeming to? For me ... more testing and more coffee ;-) Specifically with a greater range of values, such as version numbers before and after the 3.x.x range. OK you twisted my arm into indulging in another cup of coffee (mmm coffee). You're correct. It only seemed to work with the originally given values. Changing the list to: cfset appVers = 10.2.4,3.6.1,3.6.5,3.6.3,3.6.10,1.2.5 Resulted in a sorted list of: 3.6.1, 3.6.3, 10.2.4, 1.2.5, 3.6.5, 3.6.10 I was more surprised that it seemed to have worked than I would have Exactly, and that is why I am suspicious. I was not expecting text to work at all, for obvious reasons. Neither was I expecting numeric to work because values like 3.6.1 are not numeric. At least not in the strict sense. Hence my reluctance to say it it works CF -is- treating these like some sort of numeric value tho... because if I added a value like 10.2.5.4 to the original list, a numeric listSort fails saying a non-numeric value was found. So CF sees x.x.x as a valid numeric value, but apparently not base 10 based on the sorted result above. -- Charlie Griefer http://charlie.griefer.com/ I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337343 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: List Sort help
So CF sees x.x.x as a valid numeric value WTH,, x.x.x is numeric but x.x.x.X is not? Maybe CF is treating x.x.x as some weird date format, and that is how it is able to sort numerically sort-of... ? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337345 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: List Sort help
So CF sees x.x.x as a valid numeric value, but apparently not base 10 based on the sorted result above. I am pretty sure it treating the values as dates. Go figure. cfset appVers = 10.2.4,3.6.1,3.6.5,3.6.3,3.6.10,1.2.5 cfset appVers = ListSort(appVers, numeric, desc) cfloop from=1 to=#listLen(appVers)# index=x cfset asText = listGetAt(appVers, x) cfset asDate = createODBCDate(asText) cfoutput #asText# == #asDate#br /cfoutput /cfloop ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337349 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm