From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to change SubVi's case selector for all SubVi's calls

Solved!
Go to solution

Hello,

 

to make code more elegant and sensible, I source code often called out  to a SubVi. This SubVi is a case structure. If I add afterwards new cases to this SubVi, I have to renew all Enum selectors for the SubVi calls by hand. This is really annoying.

 

Is there any way to couple the selector to the SubVi so that a change in the number of cases will affect all the selectors automatically?

 

Best regards

Carsten

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

Yes.  You want to use type definitions.

 

Take one of your enum constants and turn it into a control.  Do an Advanced/Customize on the control.  From the toolbar at the top of the Control editor, select TypeDef rather than control.  (TypeDef (Strict) is okay also.).

 

Save the control with a filename.ctl extension. 

 

Go back and turn that control back into a constant.

 

Replace all constants wherever used, with the typedef'ed version of the constant.  Edit the SubVI so the Enum control that you use in the connector pane is also the TypeDef control.

 

Now whenever you update your subVI, you can add a new item to the Enum control and resave the control.  Everywhere that control is used (including the constants) will have the new item automatically added.

Message 2 of 4
(2,695 Views)
Solution
Accepted by topic author somehow.different

Thank you very much. This works just perfect.

 

Carsten

0 Kudos
Message 3 of 4
(2,680 Views)

Please mark Ravens Fan's post as a solution to your problem. So that in future those who are facing the same problem will get benefitted by the solution.

 

Thanks,

Mathan

Message 4 of 4
(2,660 Views)