LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

While loop issue

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

 

 

0 Kudos
Message 1 of 6
(1,521 Views)

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.

Read All File Lines.png

 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

Message 2 of 6
(1,511 Views)

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

0 Kudos
Message 3 of 6
(1,495 Views)

@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.

 

Frozen_0-1657287521605.png

 

---------------------------------------------
Former Certified LabVIEW Developer (CLD)
0 Kudos
Message 4 of 6
(1,486 Views)

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.

 

altenbach_0-1657287531070.png

 

If you load the values once, do it in the init state of a proper state machine.

 

0 Kudos
Message 5 of 6
(1,481 Views)

@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.

Read All File Lines.png

 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".

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 6 of 6
(1,454 Views)