LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Polymorphic VI

Solved!
Go to solution

Dear All,

 

Is it possible to force polymorphic VI to adapt to the data type, based only on a specific input of the connector pane?

Namely, if I have a VI that accepts either numbers or arrays in the input, when I connect array in one of the inputs, it adapts to the array. Now, If I connect 2nd input as a number, I get an error on the array wire and not on the number wire.

alljustforfun11_0-1574006475997.png

alljustforfun11_1-1574006528324.png

If I first connect numeric to the top-most input, and then array to the second one, I get an error on the array wire, which is what I want. How to force PolyVI to adapt based on the top-most input only?

 

Thank you in advance.

 

0 Kudos
Message 1 of 4
(2,163 Views)

Hi fun,

 


@alljustforfun11 wrote:

Now, If I connect 2nd input as a number, I get an error on the array wire and not on the number wire.

If I first connect numeric to the top-most input, and then array to the second one, I get an error on the array wire, which is what I want. How to force PolyVI to adapt based on the top-most input only?


A polymorphic VI will adapt to inputs on all input connectors, you cannot limit polymorhic behavior to just one input…

 

Your two explanations are hard to understand: in the first paragraph you don't want to get an error on the array input, in the second paragraph you want to get the very same error?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 4
(2,145 Views)

Sorry If the explanation is confusing. I want to never get an error on the top-most node, making it the decision maker, which version is going to be used. What is unclear to me is: when I connect array to the top-most input, I dont get an error. That means, that now polymorphic VI is in array version of it. Then, I connect numeric (one number) to the 2nd input. Since now my VI is in array mode, I expect this connection to have an error, asking for the array. But what happens is VI switches into single number version and outputs an error on the array wire, although it was connected first.

 

 Why is that happening and is there a simple way to make it behave as described before?

(It is 1st time I am trying to use adaptable polymorphic VIs, therefore I am learning by doing🙂)

0 Kudos
Message 3 of 4
(2,131 Views)
Solution
Accepted by topic author alljustforfun11

You did not say what LabVIEW version you are using, but if you are using a recent version, a much better options would be to create a malleable VI. Use the type specialization structure to define the behavior based on the inputs. Much easier to manage.

Message 4 of 4
(2,118 Views)