Whatever message this page gives is out now! Go check it out!
ValueArray (Object query, String columnName)Parameter | Req/Opt | Description |
query | Required | The query to be iterated over. |
columnName | Required | The name of the column whose values you want to return. |
<cfscript>
myQuery = queryNew("id,name,amount","Integer,Varchar,Integer",
[
{id=1,name="One",amount=15},
{id=2,name="Two",amount=18},
{id=3,name="Three",amount=32},
{id=4,name="Four",amount=53}
]);
// Convert the values in the column Address into the array myColumn
arrayList=ValueArray(myQuery,"name")
// Display array values
writeDump(arrayList)
</cfscript><cfscript>
// Execute a query from table Orders
myQuery=QueryExecute("select * from orders",[],{datasource="cfartgallery"});
// Convert the values in the column Address into the array myColumn
myColumn=ValueArray(myQuery,"Address");
// Display array values
writedump(myColumn);
</cfscript><cfscript>
a=[];
q = queryNew("foobar", "", [["foo"],["bar"]]);
a.append(q["foobar"], true);
writeDump(a);//returns same result as q.valueArray("foobar")
</cfscript>