How to create a list of database field types from a query
For a page I'm writing i need to be able to select what the field types are from the query we're running on the database. We allow dynamic table creation so getting this data helps us determine what output form fields we need to display when users are editing the data. Here is the code to get that data
<cfset qMetaData = getmetadata(qEvents)>
<cfset queryFieldTypes = '' />
<!--- lets loop over the metaData and select the values from the query --->
<cfloop from="1" to="#arrayLen(qMetaData)#" index="loopCount">
<cfset queryFieldTypes = qMetaData[ loopCount ].typeName & ',' & queryFieldTypes />
</cfloop>
<!--- show the list --->
<cfdump var="#queryFieldTypes#" label="queryFieldTypes" />
So what's going on?
And that's all there is to it :)





There are no comments for this entry.
[Add Comment]