AnsweredAssumed Answered

Script to deal with inconsistent number of years

Question asked by ultranix on Feb 13, 2015
Latest reply on Feb 14, 2015 by ultranix

Title

Script to deal with inconsistent number of years

Post

I need you to help me with the concept or idea how to get the results I need to get.

The idea. I have stock market data, which I'm going to import, make some calculations and later use for my testing purposes. I have 30 of Dow Jones Industrial Average stocks. Most of the stocks have 5 years of data (2010, 2011, 2012, 2013 and 2014), but some were listed, let's say in 2012 and it has only 3 years of data. As I'm splitting yearly files into google-2010, google-2011, google-2012, etc. After making calculations in each yearly file, I want to import all files into one, let's say - google (without any year and dash), because it's faster to make complex calculations with replace field contents scripts with lower amount of data.

Issues. So the issues here are basically 2.

1) When I go with a loop script from a table STOCK and set STOCK::tick as a variable and conditionally open every file, how can I open and run calculations with correct number of files, i.e. if there's 5 years of data, open 5 files, if 4 - 4, and so on. (and the go to next record and repeat the process)?

2) When I have all files with calculation scripts performed, how can I import correct number of files - if 5 files with calculations, then import all 5, if 4 - 4 and so on. ?

Outcomes