tracker issue : CF-4137857

select a category, or use search below
(searches all categories and all time range)

numeric column value does not have member methods like .len()

| View in Tracker

Status/Resolution/Reason: Closed/Won't Fix/

Reporter/Name(from Bugbase): Henry Ho / Henry Ho (Henry Ho)

Created: 04/08/2016

Components: Language

Versions: 11.0

Failure Type: Incorrect w/Workaround

Found In Build/Fixed In Build: CF11_Final /

Priority/Frequency: Major / All users will encounter

Locale/System: English / Win All

Vote Count: 4

Problem Description:

member function like .len() not available for numeric value from query

Steps to Reproduce:

<cfquery name="test" datasource="ws_engine">
	select 1 as number;

<cfset x = test.number>
<cfdump var="#len(x)#">
<cfdump var="#x.len()#">

Actual Result:

1 1 
exception: The len method was not found. 

Expected Result:

1 1 1

Any Workarounds:

use len() instead of member function

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	4137857

External Customer Info:
External Company:  
External Customer Name: Henry Ho
External Customer Email:  
External Test Config: My Hardware and Environment details:



Consistency, Consistency, Consistency.
Vote by External U.
3126 | April 08, 2016 07:40:03 PM GMT
Same for list member functions like .filter()
Comment by External U.
3121 | April 21, 2016 04:55:41 PM GMT
Hi Henry, There is .listFilter memberfunction for list. For list member functions, we have used list as prefix like: listAppend, listFind..
Comment by Awdhesh K.
3122 | August 05, 2016 01:51:16 AM GMT
Hi Henry, Member function's support has mainly been added for in-built CF data structure like Struct, list, array, Data, query. Currently, it is not supported for int primitive type (the object under discussion) and it is not planned for near future as well. Reason, member functions have performance overhead over headless functions and unless an object is very generic and highly used, we might not add Member function support for it.
Comment by Awdhesh K.
3123 | August 05, 2016 01:52:02 AM GMT
> it is not supported for int primitive type CFML does not have any concept of an "int primitive type". You're confusing the Java class used behind the scenes to store the value for a variable which can be used as a number, or string, or list... If a variable can be used as a string, and passed into string functions, why can't it have string member methods? Are the types of CF variables not what we make them at runtime? If I treat a variable as a string, then it _is_ a string. I shouldn't be concerned with the Java class currently being used on the backend to store the value.
Comment by External U.
3124 | September 07, 2016 10:49:26 PM GMT
Still disappointed to see this rejected. This really annoying behavior makes CFML unpredictable and makes me think twice every time I go to use a member function. Will it work? I never know. Behind the scenes Java details should never affect me as a user of CFML, which is a loosely typed language and allows me to do "stringy" things with variables that can be coerced to a string. This has always been the case with BIFs.
Comment by Bradley W.
3125 | March 21, 2018 04:49:55 PM GMT
+1 - This needs reopened/fixed. If simple values come in thru a query or URL parameter, we should be able to run .trim()/.len()/etc on them w/o having to worry about if the underlying data type is numeric or bla. Stringy member functions should simply work on all simple values.
Vote by Aaron N.
26400 | March 28, 2018 08:01:44 AM GMT
Hi Adobe, I've verified this is fixed in CF2018 Public Beta Update 1 (build 2018.0.01.308605). This ticket should be changed from "Closed/Won't Fix" to "Closed/Fixed". +1 to what Brad said, BTW. CF is a loosely typed language and needs to act like it. To act otherwise just adds to developer confusion. When developers define simple variables, they are not also defining a type (ex: boolean, double, int, bigint, etc). _CF_ defines that type, behind-the-scenes automagically. Thus that is outwith the control of, and concern of, the developer. Any performance impact is for CF to shoulder w/o creating language confusion. Thanks!, -Aaron
Comment by Aaron N.
27579 | April 25, 2018 06:47:52 AM GMT