AXForum  
Вернуться   AXForum > Microsoft Dynamics CRM > Dynamics CRM: Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 26.04.2011, 21:09   #1  
Blog bot is offline
Blog bot
Участник
 
25,491 / 846 (79) +++++++
Регистрация: 28.10.2006
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.ru...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:

<?xml version="1.0"?>

<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">

<channel>

<title>USD Exchange Rates</title>

<description>Grabs USD exchange rates from Yahoo Finance and outputs as RSS feed.</description>

<link>http://pipes.yahoo.com/pipes/pipe.info?_id=_kHVIdZ13hGXgt1VwmH_9A</link>

<pubDate>Mon, 18 Apr 2011 07:55:57 +0000</pubDate>

<generator>http://pipes.yahoo.com/pipes/</generator>



<item>

<title>AED</title>

<description>3.6729</description>

<guid isPermaLink="false">1</guid>

<pubDate>Mon, 18 Apr 2011 09:00:00 +0000</pubDate>

</item>

<item>

<title>AFN</title>

<description>43.00</description>

<guid isPermaLink="false">2</guid>

<pubDate>Mon, 18 Apr 2011 10:53:00 +0000</pubDate>

</item>

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.

-Bardur Knudsen



Источник: http://feedproxy.google.com/~r/Micro...-from-rss.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 


Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 18:01.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.