Columnmap "Gotcha" with CFFEED

I ran into this bug a week or so ago and just helped a user who ran into the same problem. When providing a query to CFFEED to generate an RSS string, you can provide alias information in the form of a columnMap structure. Basically it is a way to tell ColdFusion that column X maps to property Y of the RSS feed. If you try to use this feature though you will probably run into a bug. Consider this code from ColdFusionBloggers’s RSS feed:

<cfset items = application.entries.getEntries(1,url.max)> <cfset props = {version="rss_2.0",title="coldfusionBloggers.org Feed",link="http://www.coldfusionbloggers.org",description="Feed of the latest items aggregated."}> <cfset cmap = {publisheddate = "posted", rsslink = "url" }>

<cfset items = items.entries>

<cffeed action=”create” properties=”#props#” columnMap=”#cmap#” query=”#items#” xmlVar=”result”>

<cfcontent type=”text/xml” reset=”true”><cfoutput>#result#</cfoutput> </code>

The variable cmap is my columnMap structure. When I tried this it didn’t work and threw an error:

The query attribute input does not contain any column by the name of url. There is a problem in the column mappings specified in the columnMap structure.

Turns out that the columnMap structure will only work if you use upper case. So I switched around my structure to look like so:

<cfset cmap = {publisheddate = "POSTED", rsslink = "URL" }>

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Comments