Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > RSS Transformation for Multiple Document Types View modes: 
User avatar
Member
Member
Armysniper89 - 4/9/2011 10:25:30 PM
   
RSS Transformation for Multiple Document Types
I am trying to create an RSS feed with the DocumentDataSource and the RSS Repeater. I created a DataSource that has Articles and my own custom data type Case Study which is similar to an Article. The problem is I need to make them look the same in an RSS field...so tried the following but I cannot get it to work right. Case Study has fields "CaseStudyName" which is the same as "ArticleName" in Article. I also have "TeaserText" which is the same as ArticleTeaserText. Short of naming the fields the same which i would like to avoid...how can I get this code to work?

<%@ Control Language="C#" AutoEventWireup="true" Inherits="CMS.Controls.CMSAbstractTransformation" %>
<%@ Register TagPrefix="cc1" Namespace="CMS.Controls" Assembly="CMS.Controls" %>
<item>
<guid isPermaLink="false"><%# Eval("NodeGUID") %></guid>
<title><%#IfEmpty(Eval("ArticleName"), <![CDATA[ Eval("CaseStudyName",false)]]>, <![CDATA[ Eval("ArticleName",false)]]>) %></title>
<description><%#IfEmpty(Eval("ArticleTeaserText"),<![CDATA[ Eval("TeaserText",false)]]>, <![CDATA[ Eval("ArticleTeaserText",false)]]>) %></description>
<pubDate><%# GetRSSDateTime(Eval("DocumentCreatedWhen")) %></pubDate>
<link><![CDATA[<%# GetAbsoluteUrl(GetDocumentUrlForFeed(), Eval("SiteName")) %>]]></link>
</item>

User avatar
Kentico Support
Kentico Support
kentico_zdenekc - 4/12/2011 11:11:20 AM
   
RE:RSS Transformation for Multiple Document Types
Hi,

could you please specify the settings of the DocumentsDataSource? Are you putting two classnames into it's Document types (classnames) property?

This could be a problem since the view that connects them into one table is not available by default, you may need to use QueryDataSource and connect it using SQL JOIN in custom query.

You could then check if the field is defined or empty for currently displayed record and render appropriate output.

Hope this will help.

Regards,
Zdenek

User avatar
Member
Member
Armysniper89 - 4/12/2011 4:55:14 PM
   
RE:RSS Transformation for Multiple Document Types
I solved it...I just forgot to post the fix. For those that might want to do what described above...here is my transformation for the RSS:
<item>
<guid isPermaLink="false"><%# Eval("NodeGUID") %></guid>
<title><![CDATA[<%# IfEmpty(Eval("ArticleName"), Eval("CaseStudyName", false), Eval("ArticleName", false)) %>]]></title>
<description><![CDATA[<%# IfEmpty(Eval("ArticleTeaserText"), Eval("TeaserText", false), Eval("ArticleTeaserText", false)) %>]]></description>
<pubDate><%# GetRSSDateTime(Eval("DocumentCreatedWhen")) %></pubDate>
<link><![CDATA[<%# GetAbsoluteUrl(GetDocumentUrlForFeed(), Eval("SiteName")) %>]]></link>
</item>