LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Files .txt

Solved!
Go to solution

Hola amigos, quiero hacer un programa que haga lo siguiente:

Leer un arichivo .txt

Encontrar si el archivo contiene la palabra "Failed

Abrir el siguiente archivo y buscar la palabra "Failed"

Asi sucecivamente en una determinada carpeta

Para poder graficar cuantos arichivos contienen la palabra "Failed"

 

Pero no se como hacer que abra el siguiente archivo que este en la carpeta

Alguien me podria ayudar?

 

Adjunto el VI

 

 

0 Kudos
Message 1 of 9
(1,825 Views)

Hello friends, I want to make a program that does the following: Read a .txt file

Find if the file contains the word "Failed

Open the following file and search for the word "Failed"

So successively in a certain folder

To be able to graph how many files contain the word "Failed"

But I don't know how to make it open the next file that is in the folder

Someone could help me? I attach the VI

0 Kudos
Message 2 of 9
(1,824 Views)

Could you supply an example file?  I think your analysis could be simplified quite a bit.

 

As far as going through the files, use the the List Folder function to get the list of txt files in a folder and run that array though a FOR loop to analyze each file.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 9
(1,790 Views)

Hi

I attached the example file

 

I think that like you say could be something simple, but a don't know how to start 🤔☹️

0 Kudos
Message 4 of 9
(1,720 Views)
Solution
Accepted by topic author jesusglzFELE

I would just read the entire file and then use Search/Split String to find the line with the UUT Result.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 5 of 9
(1,709 Views)

Thanks!!!

Too much easier than I was thinking!

0 Kudos
Message 6 of 9
(1,700 Views)

Hi friend!

I try to make the code, but my program don found the file, even initialize the For loop

Can you take a look?

0 Kudos
Message 7 of 9
(1,681 Views)
Solution
Accepted by topic author jesusglzFELE

1. Your pattern needs to be "*.txt".  The * is a wildcard that can be any combination of characters.  Since we put it at the front of the pattern, we are saying any file that ends in ".txt".  As you have it, the List Folder will only return files actually named ".txt".

2. No need to wire up the N terminal on the FOR loop.  The autoindexing tunnel will tell the FOR loop how many times to iterate.

3. No need to the wait inside of the loop.  You are just slowing it down for no good reason.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 8 of 9
(1,675 Views)

Got it!!

Now I'm trying to read different lines in the same file

Station DAQ

Status :Failed

Only if have this two conditions it will count 

 

Sorry I found the solution! I just put another Search/Splie after then the 1st

 

jesusglzFELE_0-1649104997432.png

 

Download All
0 Kudos
Message 9 of 9
(1,663 Views)