An often requested feature is automatic download of currency exchange rates, and this short article illustrates how you can build your own using RSS feeds and MS XMLDOM 6.0 which should work with all NAV versions 2.0 to 2009R2. Going forward, you should consider using DotNet types instead.
There are a lot of RSS feeds out there, some free and some not. The basis of all of them is that you can simply load them into an xml document and parse the data from there. The good news is that the RSS format is standardized. The bad news is that every RSS feed provider has a lot of freedom to specify the data as they choose. Therefore we will just look at one example using Yahoo, and you may build your own from there.
If you go to e.g. http://pipes.yahoo.com/pipes/pipe.run?_id=_kHVIdZ13hGXgt1VwmH_9A&_render=rss you will see a list of currencies and their exchange rates relative to USD as shown here:
If you download the rss feed and save it as an xml file, you get a layout similar to this:
<rss version="2.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:yt="http://gdata.youtube.com/schemas/2007">
<title>USD Exchange Rates</title>
<description>Grabs USD exchange rates from Yahoo Finance and outputs as RSS feed.</description>
<pubDate>Mon, 18 Apr 2011 07:55:57 +0000</pubDate>
<pubDate>Mon, 18 Apr 2011 09:00:00 +0000</pubDate>
<pubDate>Mon, 18 Apr 2011 10:53:00 +0000</pubDate>
And so on...
The task is then just to parse the information.
I have attached two objects in text format, table 50000 and codeunit 50000 that illustrate how you might implement some code that parses the input and updates the currency exchange rate table.
NOTE!! The code is sample code and serves only the purpose of illustration and cannot be guaranteed to work or to be correct, and Microsoft does not take any responsibility in how the code is utilized. Furthermore, there may be legal or financial responsibilities in utilizing a particular RSS feed, and the use of Yahoo's RSS feed is only one example.