LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Want to load data from last 2 months, from a .txt-file into a table

Hi,

 

I have a problem and I can't figure it out.

In my program I'm collecting data from severall things, such as alarms.

You can see it as a logfile.

The file is saved as a .txt-file.

 

There can be data from the last year or years in it, but that is not important relating to my question.

My question now is:

Is it possible to read only the data of the last 2 months out of the .txt-file?

And I also want to put the data of the last 2 months in a table, so that I can read out the log-file on my screen.

 

I hope someone can help me.

 

Greetings,

 

Kenny

0 Kudos
Message 1 of 15
(3,010 Views)

I forgot to say that the date and time are standing in the log .txt-file.

For every action that is made there will also be a date and time.

A line that is written to the .txt-file is such as this one:

12/9/2009 11:21:03 AM <no user> Control Centre started 

Greets

0 Kudos
Message 2 of 15
(3,009 Views)

I forgot to say that the date and time are standing in the log .txt-file.

For every action that is made there will also be a date and time.

A line that is written to the .txt-file is such as this one:

12/9/2009 11:21:03 AM <no user> Control Centre started 

Greets

0 Kudos
Message 3 of 15
(3,006 Views)
can you attach the txt file so that we can help.
Tim
GHSP
0 Kudos
Message 4 of 15
(2,996 Views)

Yes I can do that.

Here it is.

0 Kudos
Message 5 of 15
(2,992 Views)

You say that it's not important that the file has years of data in but that is very important since it greatly affects the size of the file. Storing that much data in a single file is a really bad idea. A database would have been much better and your query for data within a certain date range would have been trivial.

 

With a text file, you will have to read the whole thing (unlikely) or in pieces. Reading line by line would almost certainly take to long. By starting at the end of the file, read (i.e. with Read From Text File) in a certain amount and look at the date field. If the earliest date is within your range, read in another piece of the file. Repeat. Discard al the lines that are earlier than your range.

 

Another possibility is to just convert the huge file into a database. You would still have to read data in by chunks and it would probably take a while but it would be a one time effort and going forward, you would have a much better system.

0 Kudos
Message 6 of 15
(2,983 Views)

The file I just uploaded is just from today and yesterday, for testing.

 

This file is a file with a lot of data in it, so you can use it.

 

0 Kudos
Message 7 of 15
(2,976 Views)

Try this.  It is slow.  Maybe someone will have a better way to do the job.

 

 

Jean-Marc

0 Kudos
Message 8 of 15
(2,957 Views)
This should work. It is very basic but you should get the idea.
Tim
GHSP
Message 9 of 15
(2,956 Views)

Hi,

 

I have a older version of Labview, version 8.2.1.

Is it possible for you to save it as a file for older versions.

 

Thanks

0 Kudos
Message 10 of 15
(2,946 Views)