Get dividends information for US companies. The data is parsed from an RSS feed and is inserted into a database whose name is 'dividends_rss'. This database has a date and a title column. The title generally contains useful information about the dividend being paid by the company. It also usually contains the dividend amount.
This amount could be extracted using regular expressions. In Pre-Scripting you can add the formula described below to extract this dividend value. You also need to create a new numeric field in this dividend database, so that the extracted value will be associated to the newly created field.
Go to the 'database editor', select the 'dividends_rss' database then create a new numeric (double) field. Update the current downloader item, select the first URL (there is only one URL) and click on 'Settings'. In the new form, click on 'Next', create a new column, assign it to the new field then click on 'Pre-Script'. Add the following formula inside the loop, then assign the variable 'dividendValue' to 'Content.Rows[i].Data[index] ' where index is the column index of the newly created field.
var match : System.Text.RegularExpressions.Match = System.Text.RegularExpressions.Regex.Match(Content.Rows[i].Data[1], '[$]([0-9|.])+');
var dividendValue : String = match.Value.ToString().Replace('$', '');
Example of dividends comments:
28/07/2009 11:42 - Cherokee (CHKE) Maintains $0.50 Qtr. Distribution, Yielding 10.29%
28/07/2009 11:42 - Wyndham Worldwide (WYN) Approves Qtr. Dividend of $0.04, Yielding 1.27%
If you had applied the regular expression formula, the extract dividend values would be: 0.50 for the first row and 0.04 for the second one.