LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

read from spreadsheet: a way to automatically continue if the file is missing? (Rather than having to push "continue")

Solved!
Go to solution

Hi,

I'm using the "read from spreadsheet file.vi" to read in data from a file that may or may not be present.  The data isn't required - it's optional data; nice to have but not everybody will use it.

 

Of course, if the file isn't present, I get an "Error 7 occurred at Open File+.vi:Open File", and I have the choice of pushing either the "Continue" or "Stop" button.   What I'm wondering is:  is there a way to just have LabVIEW automatically continue if the file is missing?  Perhaps it could alert the user to the missing file, but continue anyway?   Normally I'd handle this by wiring the Error output of the function to an error indicator.  But the "read from spreadsheet file.vi" function doesn't appear to have an error output.

 

I think my description of my question is sufficient, but I'm attaching a snippet of my LabVIEW code that shows the read from spreadsheet file function in question, and the error I get when the file is missing.

 

Thanks,

dan

0 Kudos
Message 1 of 7
(2,663 Views)
Before calling the read from spreadsheet, do a check for valid path.

Both the read and write spreadsheet functions are in need of replacement because they have no error in/out connections and they have the error popup. Modifying them and saving them with a new name is a pretty simple exercise and s good addition to your reuse library.

p.s. A local is not usually a good way to pass data.
Message 2 of 7
(2,654 Views)
Solution
Accepted by topic author Dan_the_Clam

CheckFile.png

 

Check to see if it exists. If so, read. If not, don't. Smiley Happy

Message 3 of 7
(2,647 Views)

Thanks!  So easy...  🙂

0 Kudos
Message 4 of 7
(2,635 Views)

Thanks, Dennis... I didn't know such a simple function existed.  And I knew somebody would object to my local!  🙂  But they're just so convenient!  I've never understood why they get such a bad rap. Without that local, I'd have to wire a big long wire from the left-side of my program to the other - a big hassle and hard to trace.  Yes, I know I should try to arrange my code so that it all fits on one page, but I'm not an expert programmer; my code evolves and tends to sprawl a bit.   I've never had a problem with a local variable.  Why oh why do people hate them so much!  I'm a friend of local variables!  🙂

0 Kudos
Message 5 of 7
(2,629 Views)

@Dan_the_Clam wrote:

Why oh why do people hate them so much!  I'm a friend of local variables!  🙂


1. They use more memory

2. They require something on the front panel (even if hidden).  So that is yet another copy of your data

3. They break data flow

4. RACE CONDITIONS!!!

 


@Dan_the_Clam wrote:

my code evolves and tends to sprawl a bit.


That tells me you do not have a good architecture to begin with.  It also tells me you need to modularize your code more and use subVIs.


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 6 of 7
(2,625 Views)
Locals break dataflow. They create copies. They should not be an excuse for sloppy programming. Every time I've interviewed a prospective employee and seen locals used like yours, I've immediately dismissed that person. Style does count.
0 Kudos
Message 7 of 7
(2,624 Views)