tracker issue : CF-4198765

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

Cannot Chain ListToArray() Directly After ValueList()

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/Fixed

Reporter/Name(from Bugbase): Carl Von Stetten / Carl Von Stetten ()

Created: 05/25/2017

Components: Language, Member Functions

Versions: 11.0

Failure Type: Non Functioning

Found In Build/Fixed In Build: 301867 / CF 11 Update 16 Build :312253

Priority/Frequency: Normal / Some users will encounter

Locale/System: English / Windows 10 64 bit

Vote Count: 2

Problem Description:  In CF11, you cannot chain the member function ListToArray() after a ValueList() function.  This appears to be corrected already in CF 2016.

Steps to Reproduce: 
Here's a SSCCE: https://trycf.com/gist/20e370fee2926e1e6b4d677b9ebd0796/acf11?theme=monokai

<cfscript>
news = queryNew("id,title",
    "integer,varchar",
    [ {"id":1,"title":"Dewey defeats Truman"}, {"id":2,"title":"Man walks on Moon"} ]);
writeDump(news);

titles = ValueList( news.title ).ListToArray( );
writeDump(titles);
</cfscript>

Actual Result: Error - "Invalid Construct"

Expected Result: Should work - it works in ColdFusion 2016 and Lucee.

Any Workarounds:
Define an intermediate variable and connect the intermediate variable to .ListToArray() like this: https://trycf.com/gist/55917beda284e0af787e8b428bb8fe9c/acf11?theme=monokai

<cfscript>
news = queryNew("id,title",
    "integer,varchar",
    [ {"id":1,"title":"Dewey defeats Truman"}, {"id":2,"title":"Man walks on Moon"} ]);
writeDump(news);

temp = ValueList( news.title );
titles = temp.ListToArray( );
writeDump(titles);
</cfscript>

Attachments:

Comments: