LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting more specific class automatically

Hello everyone,


I'm using a VI in which I have an array of different types of refnums. I'd like to know if there's a way to get the most specific class “automatically”, i.e. without having to test the class name or ID and then condition it (see attached VI).


Thanks for your help!

0 Kudos
Message 1 of 7
(136 Views)

Sorry, no.

0 Kudos
Message 2 of 7
(110 Views)

If you have generic objects as an input, you cannot avoid casting them to a more specific class to use their specific properties.

 

You can kudo this (old) idea that aims to simplify want you want to do:

https://forums.ni.com/t5/LabVIEW-Idea-Exchange/Allow-vi-server-reference-type-as-case-selector/idi-p...

 

Regards,

Raphaël.

0 Kudos
Message 3 of 7
(105 Views)

@raphschru wrote:

If you have generic objects as an input, you cannot avoid casting them to a more specific class to use their specific properties.

 

You can kudo this (old) idea that aims to simplify want you want to do:

https://forums.ni.com/t5/LabVIEW-Idea-Exchange/Allow-vi-server-reference-type-as-case-selector/idi-p...

 

Regards,

Raphaël.


You could create an XNode that is a case structure with that functionality.

0 Kudos
Message 4 of 7
(59 Views)

@paul_a_cardinale wrote:

@raphschru wrote:

If you have generic objects as an input, you cannot avoid casting them to a more specific class to use their specific properties.

 

You can kudo this (old) idea that aims to simplify want you want to do:

https://forums.ni.com/t5/LabVIEW-Idea-Exchange/Allow-vi-server-reference-type-as-case-selector/idi-p...

 

Regards,

Raphaël.


You could create an XNode that is a case structure with that functionality.


On the off chance you're thinking of doing just that, maybe spend 10-15 minute listening to Darren Nattinger tell you not to use them first:

 

https://youtu.be/HKcEYkksW_o?t=589

 

(That is a link to his "LUDICROUS ways to Fix Broken LabVIEW Code" presentation from 2022 at the timestamp he starts talking about xnodes)

0 Kudos
Message 5 of 7
(52 Views)

@Kyle97330 wrote:

@paul_a_cardinale wrote:

@raphschru wrote:

If you have generic objects as an input, you cannot avoid casting them to a more specific class to use their specific properties.

 

You can kudo this (old) idea that aims to simplify want you want to do:

https://forums.ni.com/t5/LabVIEW-Idea-Exchange/Allow-vi-server-reference-type-as-case-selector/idi-p...

 

Regards,

Raphaël.


You could create an XNode that is a case structure with that functionality.


On the off chance you're thinking of doing just that, maybe spend 10-15 minute listening to Darren Nattinger tell you not to use them first:

 

https://youtu.be/HKcEYkksW_o?t=589

 

(That is a link to his "LUDICROUS ways to Fix Broken LabVIEW Code" presentation from 2022 at the timestamp he starts talking about xnodes)


Well, I wasn't thinking of doing it.  But also, at my age, someone's opinion about what I should and shouldn't do, doesn't carry much weight.

0 Kudos
Message 6 of 7
(35 Views)

Maybe I should invent a malleable XNode 🤪 (*.xnodem)!

0 Kudos
Message 7 of 7
(27 Views)