Since when is "3.6.1" (etc) a *number*?  I don't dispute that it's
made up of digits and full stops (which kinda look like decimal points
when put near digits), but numbers can't have more than one decimal
point.  So those sequence of digits and fullstops are just strings.

That value will *not* parse as a number in CF:

<cfset n = 3.6.1>

It yields a compilation error.

<cfset n = val("3.6.1")>

Will yield a value of 3.6 for n.  This:

<cfset b = isNumeric("3.6.1")>

Will yield FALSE.  IE: not numeric.

Given the elements in the list are not numbers, it's nonsensical to
attempt to sort them numerically, so I would say that CFMX7+ have a
bug here, and OBD has got it right.  Other than that OBD should be
mirroring CF's behaviour, warts 'n' all,  for the sake of
compatibility.

It looks to me like CF is doing something really thick here.  If one
adds an element that is a letter to the list, CF - correctly - errors
saying there's no numeric data.  Or if one adds a second contiguous
fullstop in one of the "numbers" (eg: "3.6..1"), it likewise errors.
However it does not fail "3.6.1".  But then... once the validation
"passes", CF goes and "sorts" the result.  I dunno what order it
thinks it's sorting in, but it ain't either numeric or just
alphabetically.  A case in point is that this list:

3.6.1,3.6.5,3.6.100,3.6.3,3.6.10

Sorts (numeric, descending) to this:

3.6.10,3.6.5,3.6.3,3.6.1,3.6.100

What order is that?

It is coincidental that the OP's list appears to be "sorted", I think.

What this means as far as OBD's best approach here?  Not sure.  The
purist in me says "do what CF does".  The realist in me says "garbage
in: garbage out, and OBD is already behaving correctly here".

I'm gonna raise a bug in the CF bugbase.  And watch it sit there
festering for a coupla years ;-)

--
Adam




On Sep 22, 5:48 pm, tjones <[email protected]> wrote:
> The following code generates a Runtime error, Error: "Data not
> supported: Cannot convert to number (3.6.1)."
>
> <cfset appVers = "3.6.1,3.6.5,3.6.3,3.6.10">
> <cfset appVers2 = ListSort(appVers,"Numeric","DESC",",")>
>
> If I run this code in CFMX7 and higher it works just fine. Does this
> need a bug report or is there a work around?
>
> Thanks,
> tom

-- 
Open BlueDragon Public Mailing List
 http://www.openbluedragon.org/   http://twitter.com/OpenBlueDragon
 official manual: http://www.openbluedragon.org/manual/
 Ready2Run CFML http://www.openbluedragon.org/openbdjam/

 mailing list - http://groups.google.com/group/openbd?hl=en

Reply via email to