Raymond Camden's Blog Rss

Columnmap "Gotcha" with CFFEED

2

Posted in ColdFusion | Posted on 07-29-2007 | 2,670 views

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:

view plain print about
1<cfset items = application.entries.getEntries(1,url.max)>
2<cfset props = {version="rss_2.0",title="coldfusionBloggers.org Feed",link="http://www.coldfusionbloggers.org",description="Feed of the latest items aggregated."}>
3<cfset cmap = {publisheddate = "posted", rsslink = "url" }>
4
5<cfset items = items.entries>
6
7<cffeed action="create" properties="#props#" columnMap="#cmap#" query="#items#" xmlVar="result">
8
9<cfcontent type="text/xml" reset="true"><cfoutput>#result#</cfoutput>

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:

view plain print about
1<cfset cmap = {publisheddate = "POSTED", rsslink = "URL" }>

Comments

[Add Comment] [Subscribe to Comments]

Hi,

We already have this bug in our tracker.

Thanks
Jayesh
Adobe CF Team
Yep, I think that was me. :)