03-08-2021 02:28 PM
Hello,
I am a student and I am doing my master's thesis. I want to include a program where people can register and that registration goes to an excel .csv file and then they are able to log in.
The goal is for the person to enter the ID and password and the program will see if it exists in the database, if it exists opens a menu, otherwise it will show an error message.
The problem I'm having is that to get out of the FOR cycle (red circle) I have to put something for the true/false. Can you help me?
Best Regards,
Inês
Solved! Go to Solution.
03-08-2021 03:02 PM
Let's state your question in a different way.
You have an array of usernames and passwords you want to compare the entered username and password. If anyone of them is true, then you wan the True case of the case structure to run. Your comparison mode of the array should be Compare Aggregates. From the picture, it looks like you have it set to Compare Elements. That way you get a single boolean whether both elements or true or not.
If you turn that tunnel into Concatenate Mode, then you'll get a 1-D array of booleans. If you do OR Array Elements, and wire that to the Case Selector, if you ever find a True among that list, the True case will run.
If you have a relatively newer version of LabVIEW, then there is a better option. You can stop the comparisons once you find the first True. Right click on the For Loop and Enable the Conditional Terminal. Wire the output of the Equals to that. The loop will then stop early once it finds a true. Feed that boolean out with the regular tunnel and wire it to the case structure because the last value will be True if it stops early, or False if it never found a match.
03-08-2021 03:28 PM
I did that and it's not working ... I send you the program and the database document. Can you take a look, please?
Inês
03-08-2021 04:50 PM
You don't have a "database document". You have a CSV text file where your data is messy. It has quotes and tab characters in it. So according you your file, your username is "1234 and the password is tabliveandlove" as they are the two things between the commas.
Also, that subArray function serves no purpose but return the same array you started with. It doesn't hurt anything, but doesn't help anything either.
Fix your CSV file and you'll be fine.
Also, sending us a VI that closes itself and has no means of aborting the VI or moving the window around while you are still in development is a real nuisance. Luckily I have an Abort.VI that allows me to kill LabVIEW VI's that struck in running.
03-09-2021 07:43 AM - edited 03-09-2021 07:44 AM
03-10-2021 07:52 AM
Hi GerdW,
Thank you for your help. My program works !
Best Regards,
Inês