12-07-2017 10:02 PM
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.
12-07-2017 10:06 PM
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.
12-07-2017 10:29 PM
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.
12-07-2017 10:45 PM
Suppose it did have that option, how do you expect the VI to behave? What would its output be?
12-07-2017 11:18 PM
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?
12-07-2017 11:20 PM
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?
12-07-2017 11:35 PM
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?
12-08-2017 12:10 AM
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.
12-08-2017 12:47 AM
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.
12-08-2017 01:08 AM
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?)