dcsimg
What would be the best solution?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   david_kelly
Posted On:   Sunday, March 18, 2007 01:28 PM

hey everyone, I have a booking sheet that I am making, for my portfolio mainly, I have had help here recently from JGuru. I was wanting to know the best way of storing the data that will be put into JTextAreas, I previously tried to do this to a normal file like myfile.ser. but I want to be able to store the data so that there is structure, so could my java program save to something like excel, or CSV file? would this be a good easy option? or is there better ways of storing the data? I was thinking of something like excel cause I could have headers and data, like this example: date, 9am, 10am,    More>>

hey everyone,

I have a booking sheet that I am making, for my portfolio mainly, I have had help here recently from JGuru.



I was wanting to know the best way of storing the data that will be put into JTextAreas, I previously tried to do this to a normal file like myfile.ser.



but I want to be able to store the data so that there is structure, so could my java program save to something like excel, or CSV file? would this be a good easy option? or is there better ways of storing the data?



I was thinking of something like excel cause I could have headers and data, like this example:

			
date, 9am, 10am, Statistics
Sunday 18 March 2007, Jean 2000022, Derek 2000021, 2


I will be storing Strings for all the booking times/who is in/who they are seeing, and various ints for statistics, why I will have dates there, is to save each day as unique data, and to store the stats for that day, eventually I will want to be able to pick a couple of dates out and calculate the stats within the picked dates.



I need the way of storing to be able to change when info in that cell has been changed.



can someone point me in the direction on how to do this? or show me a link to some page that can explain it further?



davy

   <<Less

Re: What would be the best solution?

Posted By:   Robert_Lybarger  
Posted On:   Sunday, March 18, 2007 08:03 PM

Just about any way you store data to the disk will be as good as any other way, provided you get the job done. Direct serialization of your own objects has the benefit that you don't need to write code to actually do the File I/O, but the binary forms aren't helpful to you later if you want to tweak the data directly in a text editor. Note that Java now has XMLEncoder and XMLDecoder classes to "serialize" to an XML-based format ... fairly horrid to look at, but it is all plain text, and it is all structured in a sense. Then again, if your data is really as simple as your posted example seems to be, just do a CSV-style format. There is bound to be some source code on the 'net you can grab to help you do that (I don't know of any off-hand, but google is a good friend to ask). And if not, the code to write it isn't too hard (work out a way of "escaping" the commas, then note to escape the escape characters) and the file itself is very easy to tweak if you ever need to. If you're intimidated, look around for CSV file I/O code.
About | Sitemap | Contact