Search code examples
coldfusioncfmlcoldfusion-11

Is a ValueList() a string?


I am trying to convert the results of a query into an array

this.arLibrary  = ValueList(qryLibrary.ID).ListToArray();

And I get the following error

Detail A script statement must end with ";".

The CFML compiler was processing:

  • A script statement beginning with this.arLibrary on line 43, column 9.
  • A cfscript tag beginning on line 21, column 2.
KnownColumn -1 KnownLine -1
KnownText <unknown> Line 43 Message Invalid construct.
Snippet this.arLibrary = ValueList(qryLibrary.ID). StackTrace

This does work

temp    = ValueList(qryLibrary.ID);
this.arMetricLibActive  = temp.ListToArray();

It makes me wonder if ValueList() is a string


Solution

  • Yes, it's a string. The error is a parsing issue in the CFML engine. The same syntax works fine in Lucee. File a bug like Henry suggested.

    Here's an example in the CommandBox REPL

    CFSCRIPT-REPL: foo = queryNew('bar')
    {
        "COLUMNS":[
            "BAR"
        ],
        "DATA":[
    
        ]
    }
    CFSCRIPT-REPL: valueList( foo.bar ).listToArray()
    [
    
    ]