From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Run subVi dynamically

Solved!
Go to solution

I have read a large number of post on this, but for the life of me I cannot figure out how to do this.  What I would like to do is create a pop window from my main vi that is running.  This pop up will display select indicator values but in an enlarge state so they will be visible from a distance.  Therefore I need the values in the pop up to update along with the main vi that is running.  Attached is an attempt I made from information gathered from posts.  The problem is the subvi frontpanel will not be displayed when the zoom button is pushed.  There appears to be a problem with how I am passing the reference to the subvi.

 

First am I doing this correctly?  Second, how do I connect my reference in the main vi to the subvi?

 

Thanks in advance

 

Terry

0 Kudos
Message 1 of 9
(3,351 Views)

The front panel will not open automatically when you run a VI by reference.  You need to open it explicitly, which you can do with an invoke node with the method set to Front Panel -> Open.  You can place the invoke node either in your main VI directly after the Run, or inside the VI itself.  Are you sure you want this VI to be reentrant?  That means that every time you click the zoom button you'll get a new copy of the "zoom" VI.  You may want to maintain a static reference to the VI so you can pop up the same copy when the zoom button is clicked, instead of creating a new copy.

Message 2 of 9
(3,343 Views)
Solution
Accepted by topic author Terry_S

Here's a picture illustrating what nathand told you:

 

open sub VI FP.png

I added the "FP.Open" method in the subVI, but as he said, you can do it there or in the main VI.  I like to have it in the subVI so that the user can click on the red "X" to close the subVI panel instead of clicking "stop") and the subVI will still terminate properly, but that's a matter of personal preference.

 

He has a good point about the re-entrancy.

 

I also prefer to use queues or notifiers to pass data between VIs, instead of control references, but that is also a matter of personal preference.

Message 3 of 9
(3,339 Views)

Thanks Nathand and thanks DianeS for the diagram.  You both are correct I do not need to have the subvi re-entrant.  But the way that I have the Zoom event wire gives me an error 1000 which states "the VI is not in a compatible state with this operation" if I do not have the subvi as re-entrant. Below is a diagram of my zoom event, what changes do I need to make?

Zoom Event.jpg

 

 

0 Kudos
Message 4 of 9
(3,313 Views)

Change the "8" (which means prepare for reentrant run) wired to the Open VI Reference to 0.

8 only works if the VI is actually reentrant.

0 Kudos
Message 5 of 9
(3,310 Views)

Sorry Dan_U, changing the 8 to a 0 only give me another error.  Playing around more I found that I do not need to have the static vi reference set as Strictly Typed.  Below is a diagram of what works  Thanks everybody for their input.

 

New Zoom Event.jpg

0 Kudos
Message 6 of 9
(3,303 Views)

Sorry, sure, with the static VI ref you already have a reference so no need to explicitely open one.

 

0 Kudos
Message 7 of 9
(3,300 Views)

Hi.. im new here and i have a question that i hope to ask in right place...

and i didnt know to how to make new topic?!

i have sample subvi and i want to open and run it for many time (at same time) without closeing the other ones...

what can i do to make it possible!!??

0 Kudos
Message 8 of 9
(3,156 Views)

@Abjzb70 wrote:

Hi.. im new here and i have a question that i hope to ask in right place...

and i didnt know to how to make new topic?!


Since this is an old thread that has already been marked as solved, it would be better to post this as a new question. To do this, run a search for approximately your question. If you cannot find an answer in the search results, there's a "Post this Question" link above the search results to create a new topic with your question as the subject.

 

Also, try to be more clear about what you want to do. Do you want multiple copies of the same VI to be running at the same time? If so, you can open multiple instances of a reentrant VI, and launch them dynamically. It may become complicated to manage all of them. It is always helpful if you attach your code to your post, even if it's incomplete or broken.

0 Kudos
Message 9 of 9
(3,129 Views)