I would like to write to a text file in a tab-delimited format, but I don't know how to insert tabs into the output string. Is this possible?
Announcement
Collapse
No announcement yet.
Tab-delimited Output
Collapse
X
-
That's great Gavishti, thank you. I thought it was \t, but I didn't put it between quotes. Also, I didn't see this in the File I/O section.
Now I am trying to get a grip on using formatted output. For example, if 'myVar' is two place decimal and 'myOtherVar' is a one place percentage, and both are in the same string.
Any help would be appreciated. It's simple stuff, I know, but I'm a simple minded novice (and getting a bit tired).pa-kay
Comment
-
Here is a sample line that is being sent to a file that shows how to tab delimit and fixing the number of decimal points.
sLine = sTotalTrades.toFixed(0)+"\t"+sType+"\t"+sAction+"\ t"+sDate()+"\t"+sTime()+"\t"+sEntry.toFixed(2)+"\t "+nPOS.toFixed(0)+"\t"+" ";
Slightly different tab delimination than what Gavishi posted, but either are correct. By placing the .toFixed() on the end of a variable it, the expression is a string.
Comment
-
here is a link to Chris Kryza's help file which he keeps up to date for eSignal http://share.esignal.com/groupconten...le&groupid=114 I would download and install. I often keep mine open in another window while coding.
Regarding formatting %, what kind of formatting do you want? (update - looks like Gavishti answered that one! )
Last edited by Guest; 02-26-2004, 04:23 PM.
Comment
-
Gavishti,
Yes, I could've have figured that one out, but jeeeez louizzz, isn't there an easier way to format the output? I have a Java reference book that gives a partial example of Formatted Character Output that looks like this:
DecimalFormat df = new DecimalFormat ( "#0.00;#0.00CR" );
System.out.println( df.format( -1.267) );
1.26CR // the output
Then in a table is states the '%' symbol can be used in a format string to multiply by 100 and show as a percentage. However, there is no example, and I can't seem to make this work in an eSignal script.
I was hoping to find something like this to streamline my script writing, but maybe I should just move on. Thanks for your help.pa-kay
Comment
-
Hello pa-kay,
FYI, EFS is based on JavaScript 1.5, not Java. They are two different languages. Here's a couple links to some core JavaScript 1.5 reference material.
Core JavaScript Guide 1.5
Core JavaScript Reference 1.5Jason K.
Project Manager
eSignal - an Interactive Data company
EFS KnowledgeBase
JavaScript for EFS Video Series
EFS Beginner Tutorial Series
EFS Glossary
Custom EFS Development Policy
New User Orientation
Comment
-
pa-kay,
I have no idea what level you are at. Your questions seem to indicate that you do not have decades of experience as a programmer. Maybe I'm wrong about that. There are tons of things you can do if you want to start writing your own DLLs.
I was just trying to give you a quick answer to your question using the JavaScript extension called eSignal Formula Script (efs). If you find that offensive, my apologies.
Comment
-
Gavishti,
Your post was not at all offensive. On the contrary, your suggestions helped me alot. I was just expressing my surprise (and ignorance) about the script language. I will be more careful about wording my posts in the future. Sorry it came across like that.pa-kay
Comment
Comment