07-08-2022 07:30 AM
Search didn't come up with much
I have a while loop that is supposed to start when this subvi is loaded ( grabs info from a text file to use in a drop down ) problem is it keeps looping so I cannot use the rest of the vi buttons to submit data,
this is the extraction from my file ( didn't want to embarrass myself with my mess )
operation needed is you load the vi, it will read the information of a text file and then put that information in a drop down list. once done, the OK button should be usable. ( ok button will connect to a structure that writes / reads excel file )
new born baby is keeping me from sleeping so I cant figure out the simplest thing atm so I apologise if I missed something easy
07-08-2022 07:51 AM
You are running LabVIEW 2017, but are using a deprecated function to open your file and read all the lines into an array of strings. This Snippet is from LabVIEW 2019, but you should have no trouble reproducing (and testing) it.
This is the Read Text file, after I right-click the function and choose "Read Lines". If you read the Help (right-click function and choose "Help"), you'll see the default option is to ask for a (text) file to open, the default -1 means "Read all lines", and (again by default) the file is closed when the function exits. Note that the output, "Text", is an Array of Strings, exactly what I think you want.
Bob Schor
07-08-2022 08:23 AM
Hi bob thanks for the help!
problem I have now is I need to get the string into a combo box so a user can have a drop down selection :D:D
07-08-2022 08:39 AM
@Munkshire wrote:
Hi bob thanks for the help!
problem I have now is I need to get the string into a combo box so a user can have a drop down selection :D:D
I don't see a problem.
07-08-2022 08:41 AM
Maybe a ring would be more suitable than a combo box?
What kind of problems do you have adding the strings to the combobox? It seems your code already writes them? did you verify that the array of strings contains useful values? You could probe it, right?
I strongly recommend to start with the tutorials because your code is extremely convoluted? Why do you think you need to rewrite the same strings millions of times per second in a tight while loop? Once is enough! You'll never get an error, so the loop will lever stop! Why is the path control hidden? If it is fixed, make it a diagram constant instead.
If you load the values once, do it in the init state of a proper state machine.
07-08-2022 11:19 AM
@Bob_Schor wrote:
You are running LabVIEW 2017, but are using a deprecated function to open your file and read all the lines into an array of strings. This Snippet is from LabVIEW 2019, but you should have no trouble reproducing (and testing) it.
This is the Read Text file, after I right-click the function and choose "Read Lines". If you read the Help (right-click function and choose "Help"), you'll see the default option is to ask for a (text) file to open, the default -1 means "Read all lines", and (again by default) the file is closed when the function exits. Note that the output, "Text", is an Array of Strings, exactly what I think you want.
Bob Schor
Just an FYI - because this trips me up more than I'd like to admit - the little "down arrow/left arrow" on the icon means that the node has been configured to "Convert EOL".