Hi Guys...
I've got an array of symbols
var CurrencyValue = new Array("EUR A0-FX", "AUD A0-FX", "JPY A0-FX", "CHF A0-FX", "GBP A0-FX", "SEK A0-FX", "CAD A0-FX");
and a delimited file containing "some" of those symbols, and these file contents change constantly.
CHF A0-FX|B|68.166|100000.0|-131770.0|25739659|-100000|1.3135|S|80681.908
JPY A0-FX|B|142.086|100000.0|-1.2044E7|25741257|-100000|120.05|S|80681.908
I'm trying to read through the array and set a global value equal to something if, for that symbol, it finds an entry in the report.account file.... and if it does NOT find an entry, then to set the same global variable but with a different value. Problem is... say there are 2 items in the file, and its already iterated once through the file... it sets the global value of the previous element to the wrong value. I'm not a wizard with arrays by any stretch of the imagination...
var CurrencyValue = new Array("EUR A0-FX", "AUD A0-FX", "JPY A0-FX", "CHF A0-FX", "GBP A0-FX", "SEK A0-FX", "CAD A0-FX");
var fl = new File( "account.report" );
if( fl.exists() && (!fn.exists())) {
fl.open( "rt" );
var line;
while( !fl.eof() ) {
line = fl.readln();
if(line != null){
var sline = line.split("|");
for (x=0; x<7; x++) {
nMyValue = CurrencyValue[x];
debugPrintln("X Currency is " + CurrencyValue[x] + "\n");
if(sline[0] == CurrencyValue[x] ){
var symbolvar = sline[0]+"info";
setGlobalValue(symbolvar,sline);
debugPrintln("Global Value is " + symbolvar + " Val: " + getGlobalValue(symbolvar) + "\n");
}
if(sline[0] != CurrencyValue[x] ){
var symbolvar = sline[1]+"info";
setGlobalValue(symbolvar,sline);
debugPrintln("Global Value is " + symbolvar + " Val: " + getGlobalValue(symbolvar) + "\n");
}
}
}
}
fl.close();
}
any thoughts or ideas would be greatly appreciated.
Chris
I've got an array of symbols
var CurrencyValue = new Array("EUR A0-FX", "AUD A0-FX", "JPY A0-FX", "CHF A0-FX", "GBP A0-FX", "SEK A0-FX", "CAD A0-FX");
and a delimited file containing "some" of those symbols, and these file contents change constantly.
CHF A0-FX|B|68.166|100000.0|-131770.0|25739659|-100000|1.3135|S|80681.908
JPY A0-FX|B|142.086|100000.0|-1.2044E7|25741257|-100000|120.05|S|80681.908
I'm trying to read through the array and set a global value equal to something if, for that symbol, it finds an entry in the report.account file.... and if it does NOT find an entry, then to set the same global variable but with a different value. Problem is... say there are 2 items in the file, and its already iterated once through the file... it sets the global value of the previous element to the wrong value. I'm not a wizard with arrays by any stretch of the imagination...
var CurrencyValue = new Array("EUR A0-FX", "AUD A0-FX", "JPY A0-FX", "CHF A0-FX", "GBP A0-FX", "SEK A0-FX", "CAD A0-FX");
var fl = new File( "account.report" );
if( fl.exists() && (!fn.exists())) {
fl.open( "rt" );
var line;
while( !fl.eof() ) {
line = fl.readln();
if(line != null){
var sline = line.split("|");
for (x=0; x<7; x++) {
nMyValue = CurrencyValue[x];
debugPrintln("X Currency is " + CurrencyValue[x] + "\n");
if(sline[0] == CurrencyValue[x] ){
var symbolvar = sline[0]+"info";
setGlobalValue(symbolvar,sline);
debugPrintln("Global Value is " + symbolvar + " Val: " + getGlobalValue(symbolvar) + "\n");
}
if(sline[0] != CurrencyValue[x] ){
var symbolvar = sline[1]+"info";
setGlobalValue(symbolvar,sline);
debugPrintln("Global Value is " + symbolvar + " Val: " + getGlobalValue(symbolvar) + "\n");
}
}
}
}
fl.close();
}
any thoughts or ideas would be greatly appreciated.
Chris
Comment