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.

0 Kudos
Message 1 of 3
(1,536 Views)
Solution
Accepted by 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,516 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

 

 

0 Kudos
Message 3 of 3
(1,511 Views)