LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
Darin.K

Remove Default Behavior from Array To Cluster

Status: New

Many of us at some point have wondered "Why the heck is the default number of elements for Array To Cluster equal to nine?"  No good explanation is forthcoming.  My new question is "Why should there be a default setting?".  I suggest that instead of defaulting to nine elements leading to some hidden bugs (I have at least 3 solutions involving this function), that the Array to Cluster function simply breaks the VI until a value is chosen.  Some possibilities for discussion.

 

1) Pop up the dialog upon dropping the node?  A bit Express-y

2) Double clicking the node should pop up the dialog?  I'd like that.

3)  A visual indication that the value has not been set? A few possibilities:

 

ArrayToCluster.png

4) Make the value an editable text field along the lines of the comments here:

http://forums.ni.com/t5/ideas/v2/ideapage/blog-id/labviewideas/article-id/2430/page/1#comments

 

If it is easy to do I say yes.  Don't even start down the dynamic adaptation road, that is not going to happen any time soon.

 

My main point is that this function is not used very often by most of us which means that it is not worth a major overhaul, and it is all the more unlikely that we remember all of the hidden behavior.  Therefore a simple tweak, breaking the code until a value is set makes sense.  Making it easier to set the value is a nice bonus, but secondary.

 

Someday a better method will come along (cluster support for Coerce To Type?) and this function can be put out to pasture, until then I would suggest just a little tweak.

15 Comments
Darin.K
Trusted Enthusiast
I am not going to argue for how it should be used, but I will comment on how I have seen it used. In many cases, the resulting cluster never sees the light of day, but rather lives in a wire. The bug sneaks in because the Array To Cluster/Cluster To Array operations are not always symmetric, meaning you do not get the same array back except in the special case. The well-trained eye spots this, but I can vouch that many users do not. Other times I have seen problems using the function to pass a cluster to external code, again no hint until runtime that something may be wrong. Making it nine just adds to the trouble by making it kind of work. If the default were zero I think you would always get an error, but the dialog won't allow that to be entered (sensible, I just can not test if it would be an error). That would a simple fix, the default value of zero could be bad and force a change.
tst
Knight of NI Knight of NI
Knight of NI

I am highly in favor of Greg's suggestion of wiring a type cluster into the primitive. I don't care if the current option is also kept as a polymorphic option, but I think that it's only necessary for backward compatibility. Maybe deprecate the current node and use the new node in the palettes instead.


___________________
Try to take over the world!
Darin.K
Trusted Enthusiast
Keep in mind that this is a shortcut primitive for a special case, much like String To Byte Array. Both can be handled by Type Cast (slower) or Coerce To Type if cluster support is added. I totally support implementing Coerce To Type which eliminates the need for a separate primitive.
Manzolli
Active Participant

Long time ago I had problems with this function, like Darin.K. Was hard to find cause of the problem. The default value can be 9, but almost never is the desired one! Should prompt a input  box to allow user to edit it.

André Manzolli

Mechanical Engineer
Certified LabVIEW Developer - CLD
LabVIEW Champion
Curitiba - PR - Brazil
Kevin_Price
Proven Zealot

I just commented on a partially related idea over here.   Looking over this thread, I'd also be in favor of adding a cluster type input to the conversion primitive, as Greg suggested here and others have mentioned in other Idea Exchange posts.  (Funny what you find when you happen to search for the right combo of keywords).

 

The workaround I posted in the link might help in the meantime, but also may not be trustworthy.  In the long run, I much prefer the idea of adding a typing input to the "array to cluster" primitive than relying on my typecasting workaround.

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.