Jump to content

Multiple subVI's with same name...how to choose?


Recommended Posts

Greetings,

I'm poking through someone else's Labview 7.1 code. The former owner wrote many very similar top-level VI's, so there was a chance to reuse subVI's. It appears to start a new project to create another top-level VI, he'd copy a folder that had similar LV code in it and then make changes. Sometimes he'd copy folders, sometimes just the contents, sometimes files one-at-a-time.\

Here's a typical example: A vi named 'ScreaminRead.vi' makes use of some global variables contained a subVI named 'Control Global Variables.vi'. There are many (>20) copies of 'Control Global Variables.vi' on the computer...and they may differ slightly. 'ScreaminRead' is linked to or referencing an incorrect version of 'Control Global Variables'. How do I reconnect 'ScreaminRead' to the desired version of 'Control Global Variables'?

Thanks, be glad to supply any additional info that might be useful.

...and I think this gets me to 10 posts! Yaaay!

John K.

One more bit of info: I've tried navigating in the block diagram of the top level VI to the subVI that I'd like to replace, right mouse button, select 'Replace' and find the subVI I'd like to plug in, select it, and then save the toplevel VI. But it doesn't seem to 'take'; that is, the top level VI maintains a reference to incorrect subVI. Does this occur because the subVI shows up in a bunch of places in the top level VI and I've selected just one instance?

Given that the subVI in questions contains global variables, it actually shows up on the top level VI's block diagram in various places, with different global variables. I select one of the variables, do the 'Replace' thing, but no luck.

Sorta related, is there text readable 'project file' that one can examine and potentially edit that maintains the paths to all subVI's?

Wow, lotsa info here, hope I haven't overloaded the kindness of this group.

Best,

John

Link to comment

In LV 7.1, you can do this:

Right click on the subVI in the top level VI and select "Replace" then "Select a VI" and point to the correct location of the desired subVI. As long as the VI that you replace it with has the same name as the one it replaces, LabVIEW will prompt you to replace all calls to it.

Be careful not to open up two VIs at the same time that call two different subVIs with the same name in LV7.x and below. This will cause the second one that is opened to use the subVI that is already in memory (you'll get a notification of this when it happens).

Link to comment

Greetings from sunny Massachusetts, USA...

orko: Last night I built a tiny app with one parent vi and one subvi. I made two copies of the sub vi, with slightly different names and function. Then I experimented with replacing the subVI by RMB, choosing 'Replace' and navigating to the new subVI...and that all works as expected and in line with your suggestions (much appreciated, BTW!). I'm beginning to think my problem is I'm dealing with global variables, so 'items'...variables representing one of the multitude of global variables...show up all over my calling vi. I can't select them all at the same time. I haven't found a way to replace the global variable file with another of the same name. In the past, I've avoided using globals, maybe this is one reason?

ton: That sounds exactly right for what I need. I followed some links...not a thorough search by any means...but only found a vi for LV8.2, I'm stuck at 7.1. Do you know if there's an equivalent out there for 7.1?

Thanks to both of you for your efforts on my behalf,

John

Link to comment

QUOTE(John Kelly @ Jun 28 2007, 06:11 AM)

I'm beginning to think my problem is I'm dealing with global variables, so 'items'...variables representing one of the multitude of global variables...show up all over my calling vi. I can't select them all at the same time. I haven't found a way to replace the global variable file with another of the same name.

Ah, I see. In that case to replace all of your global calls in your VI with another version, follow these steps:

1) Open the top level VI that uses the global variables.

2) Open the correct version of the global VI, which has the same name as the global VI that your top level VI is currently calling it's globals from.

3) LabVIEW should prompt you to replace the current VI in memory with the one you just opened, choose "replace".

Voila. :D

It's very similar to replacing SubVI's on your block diagram, you just don't have the ability to right click the global calls and select "Replace" from there. You must actually open up the globals VI to accomplish the replace in memory.

Hope this helped.

Link to comment

Ahhh, that worked! :thumbup: This is one time where the LV message: "Do you want to overwrite the in memory VI" was welcome!

Thanks so much, now on to run time menus, my next tragedy, but that's a story for another thread.

Flame on

I had maintaining other people's code

Flame off

Best regards,

John

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.