flat file converting string to integer / column headings
Hi,
I've a very simple csv file of the format <epoch seconds>,<value>
1210269001,0.219289541244507
1210269301,0.21416974067688
1210269601,0.207547187805176
etc
My goal is to graph this data (date on x-axis, value on y-axis).
I don't seem to be able to convert the epoch seconds column from a String into an Integer for conversion by Date() unless I insert column headings, which I can't since its a generated data file.
Without column headings, originally I started with a computed column called longdate computed as follows :
new Date(row["1210269001"] * 1000);
This always returned "Dec 31, 1969 7:00 PM" since Date expects a number, not a string, so was apparently effectively 0 or something. So then I tried this :
new Date(Integer.parseInt(row["1210269001"]) * 1000);
This generates an error during preview :
"The data type of computed column "longdate" is java.lang.Integer, but one of its value is "null", which cannot be converted to java.lang.Integer."
So finally, I tried modifying the data file by adding column headings, secs and value :
secs,value
1210269001,0.219289541244507
1210269301,0.21416974067688
1210269601,0.207547187805176
And then new Date(row["1210269001"] * 1000); worked fine. So my final question is how do I do this WITHOUT the inserted column headings of secs, and value ? Is it even possible ?
Thanks a bunch.
-Dom
I've a very simple csv file of the format <epoch seconds>,<value>
1210269001,0.219289541244507
1210269301,0.21416974067688
1210269601,0.207547187805176
etc
My goal is to graph this data (date on x-axis, value on y-axis).
I don't seem to be able to convert the epoch seconds column from a String into an Integer for conversion by Date() unless I insert column headings, which I can't since its a generated data file.
Without column headings, originally I started with a computed column called longdate computed as follows :
new Date(row["1210269001"] * 1000);
This always returned "Dec 31, 1969 7:00 PM" since Date expects a number, not a string, so was apparently effectively 0 or something. So then I tried this :
new Date(Integer.parseInt(row["1210269001"]) * 1000);
This generates an error during preview :
"The data type of computed column "longdate" is java.lang.Integer, but one of its value is "null", which cannot be converted to java.lang.Integer."
So finally, I tried modifying the data file by adding column headings, secs and value :
secs,value
1210269001,0.219289541244507
1210269301,0.21416974067688
1210269601,0.207547187805176
And then new Date(row["1210269001"] * 1000); worked fine. So my final question is how do I do this WITHOUT the inserted column headings of secs, and value ? Is it even possible ?
Thanks a bunch.
-Dom
0
Comments
-
oops that last line that works meant to read new Date( row["secs"] * 1000);0
-
Answering my own question - in the end, I found row[1] , row[2] etc to work fine.0
Categories
- All Categories
- 108 Developer Announcements
- 53 Articles
- 106 General Questions
- 145 IM Services
- 43 OpenText Hackathon
- 32 Developer Tools
- 20.6K Analytics
- 4.1K AppWorks
- 8.9K Extended ECM
- 899 Cloud Fax and Notifications
- 77 Digital Asset Management
- 9.3K Documentum
- 29 eDOCS
- 120 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management