Reputation: 1299
I am helping a friend with a Coldfusion issue, I am just having difficulty with a simple problem. We are trying to obtain the column names coming from a SQL table and the way we do that is by doing the following:
Now we are trying to get the same info but from an Array of Structures (see screen shot attached here).
<cfdump var="#ApiData#">
<cfset numColumns = StructCount(ApiData[1])>
<cfdump var="#numColumns#">
<cfdump var="#ApiData[1].Created#">
<cfabort>
<cfloop from="1" to="#numColumns#" index="i">
<cfset ColumnNames = ?how do I create an array of columns here?
</cfloop>
Thank you
Upvotes: 0
Views: 4555
Reputation: 29870
So you want an array of ["Created", "CreatedBy", etc]
?
That's just:
structKeyArray(nameOfStruct);
You don't need the loop.
Docs: structKeyArray()
Upvotes: 4