02-26-2015 12:14 PM - edited 02-26-2015 12:22 PM
Hi All,
Please see attached.
I'm trying to simplify a VI here that has a bunch of controls and wires by making lookup dictionaries for a specific data type. Example: Create a variant lookup table from an array of string references and their names, call it "system info".
The problem is that I can only group references of a particular type together for a lookup table - I end up making a polymorphic "ref array to dictionary" VI and this isn't flexible.
Is it possible to have a more generic VI that doesnt care what type of references I'm taking in?
Oh, P.S. I hate clusters.
02-26-2015 12:22 PM
You can use the "to more generic".
02-26-2015 12:34 PM - edited 02-26-2015 12:34 PM
Hey! Thanks a lot for the input.
After going down the path you sent me down, I believe I may have found an even easier way.
By right clicking on my ref in, apparently (havent ever played with this) I can select VI server class and just make it a generic control. Then I can wire anything I please right in to this subvi and my "ref array to dictionary" is no longer polymorphic!
WOOHOO
Thanks brah.
02-26-2015 12:40 PM
Glad you got it working. Mark it as accepted solution.
Michel
02-26-2015 01:18 PM
In the example shown, the 'To More Generic Class' function is completely unnecessary. The references will be coerced to a common class at the input of 'Build Array'
02-27-2015 12:12 AM
02-27-2015 08:29 AM
I disagree. I my opinion, the code is more readable without the 'To More Generic Class' functions. Even if you don't notice those coercion dots, there's nothing confusing about it.
There are cases where a latent bug may be caused by undesirable coercion, but this isn't one of them.
02-27-2015 08:45 AM
Here's a forum discussion link to coercion dot, so anyone can make their mind and you may add your though there.
http://forums.ni.com/t5/LabVIEW/Dealing-with-Coercion-Dots/m-p/926925/highlight/true#M416411
The simple example was to show that classes exist in LabVIEW, simple as that.
Michel
03-01-2015 01:00 AM
03-01-2015 02:50 PM - edited 03-01-2015 02:52 PM
Not really. References are not "different things".
I get to decide what is the "same" (bundling is also putting different things together). The inability to programmatically cluster things is a huge disadvantage to clusters in addition to their slow lookup speed.