From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to handle an empty path with Read Delimited Spreadsheet

I'm new to labview and working on my first program.  I'm creating an array of paths that is being fed into a For Loop and read with a ReadDelimitedSpreadsheet.vi.  If all paths are filled in then the program executes fine.  My problem is when there's an empty path.  It prompts the dialog box, as it should because of the default setting, but I'd rather it ignore the empty path.  Is there an easy way (a setting or option) that I can get this done rather than creating a case structure that handles what to do when it's an empty path?  I tried using "Not A Path" constant by feeding it to the ReadDelimitedSpreadsheet when I used a "Select" with an  "Empty String/Path".  It still prompts the dialog box. 

0 Kudos
Message 1 of 19
(3,195 Views)

Sure.  Detect if the path is empty.  Put the Read subVI in a case structure.  If the Path is Empty,  True, do nothing.  If it is False, execute the subVI located in the False case.

0 Kudos
Message 2 of 19
(3,191 Views)

Oh all right, I did it that way just now.  I was thinking that there should be an option to ignore empty paths when inputting Array of Paths into that .vi.  But thanks for the reply. 

0 Kudos
Message 3 of 19
(3,179 Views)

Suppose it did have that option, how do you expect the VI to behave?  What would its output be?

0 Kudos
Message 4 of 19
(3,172 Views)

It should do nothing.  In my case, I want to use an Array of Paths which, at times not all paths might be needed.  If I choose an Array of Paths and have a path empty in that array, then why would the .vi want to prompt me?  If I chose all of the paths before I run the program, why would I want to treat the empty path differently?  I do believe that most users would intend to not need that empty path if the other paths are filled in before RUN.  Wouldn't you agree? 

0 Kudos
Message 5 of 19
(3,162 Views)

So I would think the .vi would not have an output because, it recognize that the empty path was an input that it can ignore...I hope I made sense in my explanation?

0 Kudos
Message 6 of 19
(3,161 Views)

Another point on why it would be nice to have an option where the ReadDelimitedSpreadsheet can ignore Empty Paths in an Array of Paths; it will speed up the program.  I just realized that using the True Case method to detect all Empty Paths will slow things down.  Yes, it's no big deal for one or two files but, what if somebody builds a program which can possibly have 101 files that it needs to ignore?  Wouldn't it be more efficient to have the vi ignore that process entirely? 

0 Kudos
Message 7 of 19
(3,156 Views)

It won't slow anything down.

 

What you are asking to have built into the subVI is the exact same comparison process that I'm saying you need to wrap around the subVI.  If anything, the check for empty path outside the VI probably makes the code just slightly faster since it doesn't have the overhead of the subVI call.

 

The comparison process is the same whether it is inside the VI or outside the VI.

0 Kudos
Message 8 of 19
(3,149 Views)

Well...hmmm...I guess that's what I was getting wrong.  I actually don't want to call the subVI at all for Empty Paths.  But there's no way the subVI will know if it's an Empty Path until it sees it.  So instead of detecting it, maybe it would be more efficient to not send it.  Maybe the answer would be in the 1D Array of Paths.  When I create that Array, I notice that I can click and drag let's say 6 paths (elements).  I notice that if I click on the folder icon for 5 paths so I can point to the files, then it runs through those 5 paths and ignores the 6th one that looks greyed out (the only one that I didn't click on).  If I delete the content in "path 5" and try to run the program again, then it acts like it remembers there was content in there and prompts the dialog box.  That's because it's sending an Empty Path.  Is there a way to "grey" or "disable" that path again?  Other than shrinking the Array and resizing it?  Can it be automated to be more precise?  I noticed that there's an option to customize the default path but, that's not really what I'm after.  Thanks for the replies bye-the-way.  I'm enjoying LabView and learning more about it.

0 Kudos
Message 9 of 19
(3,142 Views)

Hi FarmerJ,

 

I notice that if I click on the folder icon for 5 paths so I can point to the files, then it runs through those 5 paths and ignores the 6th one that looks greyed out (the only one that I didn't click on).

So your array just contains 5 elements. The array indicator is set to show 6 elements, but the 6th element is greyed out as it doesn't exist.

 

 If I delete the content in "path 5" and try to run the program again, then it acts like it remembers there was content in there and prompts the dialog box.

You don't delete the 6th array element, but you edit it to contain an empty path. That's a huge difference!

When you want to delete an element from an array control you should right-click the element and delete it from it's context menu!

(This is pretty basic LabVIEW stuff: did you take the free beginner courses?)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 19
(3,136 Views)