LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Compare string input to every row in txt. file

Hello Labview Community,

I need help for a part of my VI. In order to execute a case, where a certain VI is to be opened, one has to type in a new username and password, which is saved as a concatenated string, seperated by new lines in a txt. file (see (1) in picture).

 

Then one can type in a username and password, in order to execute the launch of said VI. The username and password is also turned into a concatenated string.

But to execute the VI, the program should compare the new input of username and  password to those exisiting in the txt file (see (2) in picture)

 

Udklip.PNGSo my problem is basically: How can i compare a singe string input, to every line in txt. file, and then execute the rest of the code?

 

0 Kudos
Message 1 of 4
(3,294 Views)

Not able to view your code due to version compatibility, But still i can suggest you to covert the Text File information into array using (Delimited string to array) and then use Search 1D array.

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
Message 2 of 4
(3,255 Views)

@PalanivelThiruvenkadam wrote:

But still i can suggest you to covert the Text File information into array using (Delimited string to array) and then...


No.  Just right-click on the Read Text File and there is an option to "Read Lines".  Set the number of lines to be -1 (read all) and now you can use the Search 1D Array.


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
0 Kudos
Message 3 of 4
(3,232 Views)

@crossrulz wrote:

@PalanivelThiruvenkadam wrote:

But still i can suggest you to covert the Text File information into array using (Delimited string to array) and then...


No.  Just right-click on the Read Text File and there is an option to "Read Lines".  Set the number of lines to be -1 (read all) and now you can use the Search 1D Array.


Or simply read the enter file as one big text value and use Match Pattern to see if the string exists in the file.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 4 of 4
(3,228 Views)