11-04-2014 10:48 AM
This is where the old Cluster to array helps a lot. Type def the cluster of 4 elements and drive your loops with whatsist type cluster to array of exactly 4 elements (or however many whatsits are in the cluster)
11-04-2014 11:23 AM
There you go, DACAD - if your logic requires four and only four items, then why not make your TypeDef a cluster of four items?
If you absolutely need an array, then use CLUSTER to ARRAY, otherwise just deal with the cluster directly.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
11-04-2014 11:29 AM
This is a very old legacy set of vi's and typdef so I had never given any though on changing the methology of it but revising to a cluster would essentially error proof it. It would also let meuse the captions on each item of the cluster to ID each of the four controls as needed.
I little work to go throough and change all that but if this thing boinks again, I would have to do that anyway.
Yea, think I will go ahead and run that path.
Thanks for all the input.
11-04-2014 11:40 AM
I've never felt a compelling need to typedef an array because a typedef'd array doesn't really mean anything to me. I very often drop typdef'd stuff inside the array, though.
11-04-2014 12:08 PM
I've never felt a compelling need to typedef an array because a typedef'd array doesn't really mean anything to me.
I have TypeDef'ed them for cosmetic purposes. If a particular array appears in a variety of places and you want them all to be 1069 x 154 pixels, well, it will help you enforce that. Beyond that, though, I agree with you: I always typedef the ENUM itself, and then have an array of them somewhere.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
11-05-2014 06:45 AM
Just a follow up. I converted the typedef to a cluster of four elements (enums) and applied and saved it. I expected to have several broken vi's due to this. To my surprise, I did not. The actual instances of the typdef updated as expected but all the constants that were originally based on the typedef also updated. This I was not expecting. The only caveat was that the constan values all reverted back to default values and I had to repair that but I was surprised it didn't cause more havoc.
I will probably never know exactly why the orignal typedef added elements to the array but going forward, I will avoid that method and use the cluster method instead.
11-05-2014 06:49 AM
Wow, you experienced all the highs and lows of typedefs all at once! I think the typdef reverting to default was fixed recently because I confirmed it happened in 2009, but I did the exact same thing in LV 2014 and the constants did NOT revert!