LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create cases acording to a global variable type "Byte Stream File reference"?

Highlighted

Try this...

it is a downgrade to LV 9.0

0 Kudos
Message 11 of 16
(128 Views)
Highlighted

Hi Thomas,

 

"Sub_VI.vi" is still in LV2012...

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 12 of 16
(124 Views)
Highlighted
0 Kudos
Message 13 of 16
(120 Views)
Highlighted

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.

 

 

 

0 Kudos
Message 14 of 16
(97 Views)
Highlighted

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
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 15 of 16
(84 Views)
Highlighted

, 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.

0 Kudos
Message 16 of 16
(77 Views)