Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading a fixed field text file

Status
Not open for further replies.

jondel81

Technical User
Jul 27, 2003
71
US
Our time clock program keeps it data in a fixed field text file. I am trying to come up with a way for a vb.net file to access the file and show the summary of the time as well as each time the person clocks in or out. I think the major problem I am having is manipulation of the data. For example, the data file looks something like this:
[tt]111123333333333333334444444455555-------
3531>Doe, John 10/31/0412:000108200
5555 Doe, Jane 10/31/0412:380107200
3333>Smith, Joe 10/31/0412:390102200
1234 Little, Amy 10/31/0413:010108200
3531 Doe, John 10/31/0417:000108200[/tt]

Numbered above are the different fields. 1 is the emp id, 2 is clock in flag (">" means in), 3 is name, 4 is date, 5 is time, and - is ignore.

Now what I would like to do is be able to pull only a select number of people and have it were its in and then out on the same line with time worked. Plus total time.

For example:
[tt]3531 Doe, John 10/31/04 12:00 - 10/31/04 17:00 : 5 hours
Total hours for Doe, John: 5 hours[/tt]

I am not sure were to begin, or if there is an easy way to do this. Thanks for your time in reading this.

------
 
you can read it one line at a time into a string array, then parse each array record at index 3 (this would give you column 1 and the rest) into two strings, then parse the second string (or longer) at index 1 (to give you the > character), then continue on down until you have 6 strings (1-5 and the last string is the - column).

you could then store the variables into a dataset for easy maintenance. that would probably work.

I don't know if i made any sense.

 
What hayt said made sense. You can use something simple like a Scripting.FileSystemObject and a TextStream to read the file in one line at a time. Each of the fields are a fixed length so basic string manipulation will allow you to parse each record and store it in an array. Once in an array you can pretty much do whatever you want. Search it, sort it, report on it etc...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top