Text file to array? problem

chucklc

New member
Joined
Feb 27, 2005
Messages
1
Programming Experience
Beginner
Hello all,

This is my first official post. I am a programming student so I might be making this harder than it is. I have spent the last 2 days doing heavy research on string classes, stringbuilder classes, regular expressions, arrays and arraylists. I have created an app that allows me to connect to any text file and open it into a textbox. I also have no problem reading a text file into an arraylist and even being able to do some formatting things to the array, but I can't find anything about doing serious things to the string after it's in the array. What I have been trying to do is append the last 5 numbers of the employee number to the 2 lines following until finding a new employee number.

Here is a sample format of a text file - this text file comes from a low end scanner.

KA11E999990889,7:42:30,02/14/05,4C11272A -- This is an employeeID
KA11A001,7:51:37,02/14/05,4C11272A -- In code for the facility
KA11A003,7:51:42,02/14/05,4C11272A -- Employee signin time
KA11E999990889,18:42:30,02/14/05,4C11272A -- employeeID again
KA11A002,18:51:37,02/14/05,4C11272A -- Out code for the facility
KA11A004,18:51:42,02/14/05,4C11272A -- Employee signout time


What I hope to do is this:

KA11E999990889,7:42:30,02/14/05,4C11272A
KA11A001,7:51:37,02/14/05,4C11272A, 90889
KA11A003,7:51:42,02/14/05,4C11272A, 90889
KA11E999990889,18:42:30,02/14/05,4C11272A
KA11A002,18:51:37,02/14/05,4C11272A, 90889
KA11A004,18:51:42,02/14/05,4C11272A, 90889

It's not going to be neatly layed out like this. With several employees clocking in and out the employee numbers can be anywhere on the text file.
So what happens is:
1. The employee gets to the jobsite and scans their employee badge which returns this string:
KA11E999990889,18:42:30,02/14/05,4C11272A

2. The employee signs in to the facility returning this string:
KA11A001,18:51:37,02/14/05,4C11272A

3. The employees actual signin time is next - this is the time that the temp agency actually uses for the clock in time:
KA11A003,18:51:42,02/14/05,4C11272A

4. When the employee is finished for the day, the employees badge is scanned again:
KA11E999990889,18:42:30,02/14/05,4C11272A

5. The facility sign out code is scanned:
KA11A002,18:51:37,02/14/05,4C11272A
*Note: There are only two facility #'s In - KA11A001 and Out - KA11A002 But these times aren't used

6. The employees signout time:
KA11A004,18:51:42,02/14/05,4C11272A

The employees signin and signout times are tied to a specific site:
Examples - Embroidery In KA11A003
Out KA11A004

Receiving In KA11A004
Out KA11A004

Bottom line - I need a way to tie an employeeID with the 2 lines immediately following it and then get the employees hours for that day using the site times.

Sorry for this long post, I'm worried and under a bit of a time crunch. Unless I'm mistaken this is a complex program that's out of my league. I'm just looking for pointers or ideas. I am on day 4 of an internship - a small 3 man operation - they sold this application before they had a programmer or a program? It's due March 3rd. =D

Thanks,
Chuck
 
Top Bottom