This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes its urgent..pls help me out!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "its urgent..pls help me out!!!" Watch "its urgent..pls help me out!!!" New topic
Author

its urgent..pls help me out!!!

bhaskaritp naidu
Ranch Hand

Joined: May 21, 2007
Posts: 45
Hi All!

These are the records in a file.i need to pasre this records and i have use these data and according to their usage ,i have create invoice(bill).

please tell me the methods to parse this file and how to store this records.


CUST001|USAGE||0044234567892|20071101081020|20071101084012|
CUST001|USAGE|4026959526|0015137233456|20071101200240|20071101200730|
CUST009|MRC|Montly Rent|119|20071101000000|20071130000000|
CUST010|MRC|Montly Rent|119|20071001000000|20071031000000|
CUST006|USAGE|4026959526|0015137233456|20071103161419|20071103161806|
CUST006|USAGE|4026959526|00914466557878|20071102121007|20071102121059|
CUST006|USAGE|4026959526|00914066232973|20071102061009|20071102062742|
CUST001|USAGE|4026959526|0015137233456|20071102161419|20071101161806|
CUST001|USAGE|4026959526|00914466557878|20071101121007|20071101121059|
CUST001|USAGE|4026959526|00914066232973|20071102061009|20071102062742|
CUST001|USAGE|2269467676|4023457689|20071102074018|20071102080722|
CUST001|USAGE|2269467676|2245674568|20071101141206|20071101141301|
CUST006|MRC|Montly Rent|119|20071101000000|20071130000000|
CUST001|USAGE|4026959526|4423556787|20071102235543|20071103014002|
CUST004|MRC|Montly Rent|119|20071101000000|20071130000000|
CUST001|USAGE|4026959526|4026959590|20071102101002|20071102101207|
CUST001|USAGE|4026959526|4026959590|20071103221012|20071103235323|
CUST006|USAGE||0044234567892|20071102081020|20071102084012|
CUST006|USAGE||0015137233456|20071102200240|20071102200730|
CUST009|USAGE|2269467676|2245674568|20071101141206|20071101141301|
CUST009|USAGE|4026959526|4423556787|20071102235543|20071102014002|
CUST001|MRC|Montly Rent|119|20071101000000|20071130000000|
CUST001|MRC|Spl Plan Fee|49|20071101000000|20071130000000|
CUST009|USAGE|4026959526|4026959590|20071102101002|20071102101607|
CUST006|USAGE|2269467676|4023457689|20071102064018|20071102080722|
CUST006|USAGE|2269467676|2245674568|20071101141206|20071101141301|
CUST006|USAGE|4026959526|4423556787|20071102235543|20071103014002|


Thanks in Advanced
Vassili Vladimir
Ranch Hand

Joined: Mar 08, 2007
Posts: 1585
Hi,

Although this is not the right forum to post your question, I'm going to answer

First of all, create a BufferedWriter on this file, this will help you read the file line by line.

After that, for each line do the following:



This will separate all the values in each record based on the '|' character.

I hope this helps ...

Best of luck ...


Vassili ...
SCJP 5.0, SCWCD 1.4, SCJA 1.0
bhaskaritp naidu
Ranch Hand

Joined: May 21, 2007
Posts: 45
Hi All!

let me first tell,what i need.

please look into the records carefully.

each cutomer have multiple records ,they are identified by their calling number.

i am giving follow records for example.

CustomerRef|EventType|CallInfo|Destination No/MRC Amount|StartTime|End Time

CUST001|USAGE||0044234567892|20071101081020|20071101084012|
CUST001|USAGE|4026959526|0015137233456|20071101200240|20071101200730|
CUST009|MRC|Montly Rent|119|20071101000000|20071130000000|
CUST010|MRC|Montly Rent|119|20071001000000|20071031000000|
CUST006|USAGE|4026959526|0015137233456|20071103161419|20071103161806|
CUST006|USAGE|4026959526|00914466557878|20071102121007|20071102121059|


I need to format this records.and i want to separate each customer records separately.and i want to store each customer details separetely.

Pls help me out in this.

Thanks in advance.
Boss.
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11280
    
  59

[Marc - thanks for closing yet another version of this.]

Bhaskaritp - we are not a code mill, but we are willing to help. For us to help you, we need you to show some effort - what have you done since Vassili gave you some hints? We would prefer it if you could post real code showing where you are at and where you are having problems.

In addition, you should carefully choose one forum, ease up, and use a meaningful subject line. You might also like to review how to ask questions on JavaRanch/

- Andrew


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by bhaskaritp naidu:
...i want to separate each customer records separately.and i want to store each customer details separetely...

Vassili's suggestion of using String's split method looks like a good start to me. How did that work for you?


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Tempora Telora
Ranch Hand

Joined: Jun 20, 2005
Posts: 83
That split is a perfect work around.

Try and create a driver class that will parse through the txt file and then create some customer classes that will store the values of the driver classes parsing.
bhaskaritp naidu
Ranch Hand

Joined: May 21, 2007
Posts: 45
First of all,i whould like to say thanks to all for your quick reply.

i did that.

now i have one more problem.i split the data and store it in array of arraylist(each customer record as one arraylist in tht).

now i need to create a invoice based on the data available in that array of arraylist.

do we have any thing to do in java.

i need to create invoice for each customer as a text file.

i am not able to copy invoice format.
eg.is like our mobile bile.


how can we create that type of bill in java(formatted bill)


Thanks in advance
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: its urgent..pls help me out!!!
 
Similar Threads
Reading large text files with multiple data types and items.
Teamwork - rail-road tracks logo - need help
pls all look into this..give me ur suggestions..urgent!!!
SQL Exeption
Jquery:- Diff between merge,extend and ||