LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
0 Kudos
Ravi_Beniwal

Wire Array directly to case structure to check for empty array

Status: Declined
Functionality already in LabVIEW.

We all (should) check if an array is empty before passing through a For Loop, if we are indexing it and any references or values pass through the For Loop so that we pass null references or default values for the data type.

 

Most people use either an "Array Size" primitive for selecting "0" or "Default" or an "Empty Array?" primitive for selecting "True" or "False" in a case structure around the For Loop.

18049i62E217D020F17D5C18051i254696F87AD8D82F

If we could just wire the array to the Case Selector and have it automatically create two cases "Empty" and "Has Data" or something, it will make the diagram cleaner and easier to read, while saving a few second for every instance of use. 

18053i19D01296C2C082C8

6 Comments
JackDunaway
Trusted Enthusiast

@Ravi Beniwal wrote:

We all (should) check if an array is empty before passing through a For Loop...


 

Wrong. Just use shift registers on the For Loop - this will clean up your syntax and prevent Null Refs. As for other use cases, I can't think of many instances where I need to check for the presence of data in an array (since I leverage the "no-execute For Loop" when the auto-indexed array has zero elements). If someone presents another use case, I will give Kudos, because I like wiring things into case structures!

 

Ravi_Beniwal
Member

Dear Permalink, Thank you very much. I wasn't aware of this. This is really good and already much better than what I was proposing. Thanks again!

RavensFan
Knight of NI

His name is Jack.  Permalink is not a name.  It just shows up at the end of every message in the Idea exchange and is just a Hypertext link back to the message.  I'm not even sure what the purpose of the Permalink link is supposed to be.

 

Smiley Wink

tst
Knight of NI Knight of NI
Knight of NI

> I'm not even sure what the purpose of the Permalink link is supposed to be.

 

It allows you to link to a specific comment. That is sometimes useful.


___________________
Try to take over the world!
RavensFan
Knight of NI

Thanks.  That makes sense.  I guess I was confused because the real forum boards to have a means to linking to a particular message, and in the idea exchanges, even the original idea has a permalink which is odd since the address bar already has the link to get to the thread.

G-Money
NI Employee (retired)
Status changed to: Declined
Functionality already in LabVIEW.