Kannan.P
Kannan.P

Reputation: 1273

QueryFilter() return array of structure in coldfusion2016. But it's should return query

Here I'm working with QueryFilter() function. I've go through this function usage & return type. The adobe docs said it's return query. But sample code return array of structure in coldfusion2016. I've tried the same code in cf2018 but it's return the query only.

So I've tried with same code trycf.com. While I choose cf2016 in trycf there also return type in query only. But I don't know why my cf2016 return array of structure. My sample code.

<cfscript>

    news = queryNew("id,type,title", "integer,varchar,varchar");
    queryAddRow(news,[{
        id: 1,
        type: "book",
        title: "Cloud Atlas"
    },{
        id: 2,
        type: "book",
        title: "Lord of The Rings"
    },{
        id: 3,
        type: "film",
        title: "Men in Black"
    }]);


    books = QueryFilter(news,function(_news) {
        return _news.type is 'book';
    });
    writeDump(books);

</cfscript>

CF2016 Output in my local :

enter image description here

CF2018 Output :

enter image description here

Could you please any one know the root causes of this issue ?

Upvotes: 1

Views: 131

Answers (1)

Kannan.P
Kannan.P

Reputation: 1273

Yes the queryFilter() should return the Filtered query.We have the issue that return type as array of structure in before update11 in cf2016. So once I've update my cf2016 from update10 to update11. It's get resolved. Now my queryFilter() function return the query only.

So update11 resolved this problem in cf2016. Thank you.

Upvotes: 2

Related Questions