Creating RSS feeds with mrc Reports

 

Creating RSS feeds with mrc Reports

This tutorial will show the step by step process to create your own RSS feeds that your end users/customers will be able to subscribe. Consider RSS feeds when you want to be able to automatically alert your users/customers of important changes. Click here to see how the mrc Support Team used RSS feeds to automatically alert customers of recent MRCCH/m-Power updates. Click here to learn more about RSS feeds.

Step 1: Build a Web 2.0 Report over the data table(s) you wish to have included in your feed. Build/Compile your report, then enter m-Painter.

Step 2: In m-Painter, click the “Source” icon.

Step 3: Remove all of the code (CTRL + A, then the “Delete” key). Your screen should now be blank.

Step 4: Paste in the following code:

<code><?xml version=”1.0″ encoding=”ISO-8859-1″?></code>

<rss version=”2.0″>

<channel>

<title> ENTER TITLE HERE </title>

<link> ENTER URL TO YOUR COMPANY SITE HERE </link>

<description> ENTER RSS FEED DESCRIPTION HERE </description>

<language>en-us</language>

<ttl>5</ttl>

<!– <#list report as section> –>

<!– <#assign lastRow = section.lastDetail /> –>

<!– <#assign grandTotal = grandTotal0 /> –>

<!–<#if (section.subtotalsc.size() > 0)> –>

<!– <#assign subTotal1 = section.subtotalsc[1] /> –>

<!–</#if> –>

<!– <#list section.detailRows as row> –>

<item>

<title>${row. FIELD ?xml}</title>

<description>${row. FIELD ?xml}</description>

<link>http://${row. FIELD ?xml}</link>

<guid>http://${row. FIELD ?xml}</guid>

<pubDate>${row. FIELD ?xml} </pubDate>

</item>

<!– </#list> –>

<!–</#list> –>

</channel>

</rss>

Be sure to replace the above text that is in red. Be sure to replace the appropriate fields (marked FIELD above) as well. Title and Description are self explanatory. The Link field will specify where the user will go if they click on that feed. The Guid field must be a URL and must be unique. The pubDate needs to be a date field.

Note: It is common practice to make sure your date is in this format: Fri, Jul 04 2008 12:00:00 GMT. You can utilize the Java Date Translator to create dates in this format, if necessary.

Step 5: Save your application.

Step 6: Run your application, specifying the HTML output.

Step 7: Right click on the Output, click “View Source”, then save the Output as a .xml file to your desktop (This is for testing purposes, we will learn how to run this in batch next).

Here is a portion of the “Source View” of my RSS Feed Report:

Step 8: To make sure this works correctly, we must load our new RSS feed. IE7 automatically loads XML files, however there are hundreds of other free RSS viewers (FeedReader is very popular). All we need to do is call the XML file in our IE7 browser:

Step 8: Success! Our RSS Feed is formatted correctly. All that is left now is to inform your users/customers of this file. Whether they use My Yahoo, Feed Reader, or Google Reader they will be notified whenever this file changes.

But wait, how can I make sure this process runs automatically, say every night, so that when the data tables change, my RSS file will be updated?

Note: This next section utilizes a utility called MRCRPTSND (mrc Report Send), that is currently only available to mrc-Productivity Series Customers.

Step 9: Utilize the MRCRPTSND command to call this program via CL. Here is what our CL looks like:

*******************************************************************

*PGM /* This CL updates an RSS feed */

*MONMSG MSGID(CPF0000)

*ADDLIBLE LIB(MRCAPPLLIB)

*MRCRPTSND RPTNUM(1) DCTLIB(MRCWORKLIB) TYPE(*JAVA) +

* NEWFILE(UPDATES) NEWDIR(‘/mrcjava/feeds/’)

*RMVLNK OBJLNK(‘/mrcjava/feeds/updates.xml’) /* +

* Remove Updates XML File */

*RNM OBJ(‘/mrcjava/feeds/updates.html’) +

* NEWOBJ(‘updates.xml’) /* +

* Renames the HTML file to XML */

*ENDPGM

*******************************************************************

In the above code we are running Report #1 from MRCWORKLIB, and placing the generated HTML file in /mrcjava/feeds. Next, we are removing the existing XML file. Lastly, we are renaming the HTML file to .XML.

The above CL simply needs to be added to your job scheduler so that it can run nightly (or at whatever time interval you wish).

 

Related Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *