LabVIEW Idea Exchange

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

Direct "global replace" using VI hierarchy.

Status: New

Sometimes we have a big application that uses "MyTweakSubVI_A.vi" in many places. One morning we wake up and discover that this subVI could be made much better, so we wire up "MyTweakSubVI_B.vi" and do a few sandbox tests to verify that it operates correctly. After we are satisfied, comes the time where we need to replace every instance of  "...SubVI_A..." with "...SubVI_B...".

 

The typical way would be to go to the VI hierarchy and "right-click...find all instances...select all...pick the replacement...replace all selected". Tedious!

 

Wouldn't it be easier if we could just right-click...replace (in the VI Hierarchy!)...pick the new VI and it would globally replace the old VI with the new VI.

 

IDEA: The VI hierarchy should have a "right-click..replace" menu entry that would directly do a global replacement of all instances of the selected VI.

 

(Of course there should be some protection in place so that anything in VI lib is not modified)

6 Comments
JackDunaway
Trusted Enthusiast

altenbach,

 

Do you think it would be easy to CTRL+Z this operation? If not, I could see this operation causing much more heartache than it solves.

 

Jack

altenbach
Knight of NI
Well, to undo you would just repeat the operation and point to the old VI again. 🙂
altenbach
Knight of NI
While it is relatively intuitive (at least to me) that the icon in the hierarchy stands for all instances of a subVI, the command could be worded to make the function even clearer. Instead of "replace..." it could e.g. say "replace all instances...". There could even be a confirmation dialog.
JackDunaway
Trusted Enthusiast

Being the devil's advocate here:

 

The operation you suggest could screw you, though. If you are using a combination of 10 SubVI_A's and 10 SubVI_B's throughout your project, and realize, "Hey, I think I can replace all _A's with my _B's." Now, you have 20 instances of SubVI_B in your project.

 

"Whoops, that won't work! I need to revert all of the ones I just replaced back to SubVI_A!" Uh-oh. Now you have 20 instances of SubVI_A when you meant to go back to the scenario of 10 and 10.

 

Being able to CTRL+Z a bonehead (or even deliberate!) programming move saves each of our tails every day. If we can't CTRL+Z, I don't want this feature added - it could prove catastrophic.

 

(Note: I am FAR from the type who thinks software should be dummy-proofed. If you consistently make dumb moves, you should be punished by losing your code. There's no way LabVIEW can predict what moves you made unintentionally. That's why there's CTRL+Z - it doesn't have to predict what you accidentally did - it just keeps up with what you did. If this Idea would be trivially easy to implement for NI with undo, I would be "for" this idea. Without CTRL+Z, however, the negative impacts outweigh time savings.)

altenbach
Knight of NI

It won't be any more or less dangerous than the "replace all" button in the "find all instances" dialog. 🙂

 

If you save you work regularly, just exit without saving or revert the relevant VIs from the menu if you regret the replacement. I have not tried to see if undo would work, maybe it even does? 😉 

 

(In the very old days, I would just close LabVIEW, rename the subVI, and re-open the toplevel. 🐵

Intaris
Proven Zealot

Three words:

 

Source Code Control