"Sub_VI.vi" is still in LV2012...
Thank you Thomas.Wetzel,
But I really dont understand how this could help me.
In your Sub VI the name of the cases in the case structure comes from a control (Control Name) ... and in your Main.vi you define the name using a constant....
What I needed was the oposite... I had already the globals (that are being used in the whole source code) and I wanted to get their labes as the name for each case, without typing manually this names.
Please let me know if I understood wrong.
Follow attached how I am doing now.
I am using this enum (an existing typedef in the original code) as a required input to the VI. I had to add this enum every time I call any of this globals in my code, according to which global is being used in the moment....
It was a little bit of boring work but for future changes in the main code, for instance, if I need a new global, I just need to change the typedef and put together with the global the corresponding enum.
I would really question the use of global variables in the first place. This just sounds like a bad design which will not be very flexible or maintainable. There are better ways of handling this such as using LVOOP with dynamic dispatch which was suggested earlier. If you are seriously thinking about creating and using 100 globals you definitely need to reevaluate your design.
While you may reuse this subVI many times using a shoft register for each data set will not be very easy to maintain. What happens wen you need to add more variations? Do you start adding more shift registers? This is not a very effective way of creating reusable code.
Mark_Yedinak, this globals exists since before I work here 😉 I cant change that, this ones are really necessary to be globals because the whole code is something huge, and I deal only with some parts of it. I have to fix or improving the code without change everything! I am not creating a new code, just improving it. About the shift registers is something else... I do have another idea for it but will complicate even more and I dont have time to spend on some small detail, considering that with this solution is already working. But I agree that in the future if necessay more globals I may change it.