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 Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
SteveChandler

Convert Global Variable To Functional Global

Status: Declined
A quick conversion tool would imply that switching from global variables to functional global variables are better (e.g. reduce code overhead, race conditions) when they are not specifically. Functional global variables can be expanded into action engines which can be more useful but a conversion tool wouldn't be appropriate for this.

As a tool to refactor inherited code it would be nice if LabVIEW had the ability to convert global variables into functional global variables. I did a search and did not find this idea and will be surprised if it is not a duplicate.

 

You would pop up on the global and select "Convert To Functional Global". The vi includes error terminals in the standard locations but are (obviously) left unwired. The name of the FG vi would default to a concatenation of the name of the global vi and name of variable.

 

 

replaceglobal.PNG

 

I will leave it up to the experts to come up with a better icon.

=====================
LabVIEW 2012


18 Comments
AristosQueue (NI)
NI Employee (retired)

> I will create a library with public vis to access the privately scoped global so I am not worried about that.

 

SteveChandler for the win!!!!

G-Money
NI Employee (retired)
Status changed to: Declined
A quick conversion tool would imply that switching from global variables to functional global variables are better (e.g. reduce code overhead, race conditions) when they are not specifically. Functional global variables can be expanded into action engines which can be more useful but a conversion tool wouldn't be appropriate for this.
SteveChandler
Trusted Enthusiast

This must be a record - new to declined in one day! Smiley Surprised

 

Hopefully this doesn't mean that this was the dumbest idea on the idea exchange Smiley Very Happy

 

But in all seriousness I am glad that the ideas are being categorized quicker.

=====================
LabVIEW 2012


SteveChandler
Trusted Enthusiast

Aristos,

 

My original intent was to convert globals to FGs so that I could wire the error terminals in some inherited code in places where I suspect possible race conditions. I was thinking about posting another similar idea that would address that particular use case. Would an option to convert a global to a shared variable make more/any sense?

=====================
LabVIEW 2012


AristosQueue (NI)
NI Employee (retired)

Yes, I think that would make more sense. Those two are more directly substitutable. I'm sort of surprised that such a conversion doesn't already exist, considering that you can change the type of a shared variable and one of the types you can pick is global. I've never used shared variables for anything more than small test apps, so I have no idea of all their abilities, but you might go poke around for a bit before posting the idea.

F._Schubert
Active Participant

Status changed to: In Development (Community)

 

I will post an announcement here when the beta is available on LAVA.

 

Felix Smiley Wink

Ray.R
Knight of NI

Thanks Steve for such an informative and lively thread.

 

You will have to visit the sister thread in the Ideas Exchange that I just posted:

http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Convert-Global-to-Shared-Variable/idi-p/1539972

 

F._Schubert
Active Participant

In beta on LAVA

 

Felix.