LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Check specific class type (exclude descendants)

Solved!
Go to solution

What's the preferred way to check if a dynamic wire is carrying a specific object type (excluding descendants)?

 

At the moment I'm using the built-in "Get LV Class Name" function and a string comparison to see if the two values match. However, string comparison in this situation just feels wrong.



Using LV2018 32 bit

Highly recommended open source screen capture software (useful for bug reports).

https://getsharex.com/
0 Kudos
Message 1 of 3
(1,125 Views)
Solution
Accepted by topic author matt.baker

Wire the class through a for loop with the count set to 0 - this will return a default instance of the wired class. Then, check that value against the class constant.

Message 2 of 3
(1,105 Views)

That's an elegant solution for getting a class' default value that I wasn't aware of. I thought it was going to fail on upcast/more generic wires, but it still works.
Thanks

mattbaker_0-1644509376775.png

 

 



Using LV2018 32 bit

Highly recommended open source screen capture software (useful for bug reports).

https://getsharex.com/
0 Kudos
Message 3 of 3
(1,100 Views)