LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Checking if a VI is running as a SubVI or standalone

Solved!
Go to solution

I have a set of measurement VIs that I use as both Standalone VIs and buried deep inside of other VIs that perform many different measurements. Because I run the VIs standalone sometimes they have Initialization, VISA Open, and VISA Close inside case structures that I've wired to a boolean (Is Standing Alone?)

 

Is there any way for the VI to determine if it's standing alone or being called without me having to toggle the Boolean all the time. It would be nice if I didn't have to worry about that whenever I run the VIs on their own.

 

I have looked into the Property Nodes "Callers' Names" and "VI Type" but they don't seem to be helpful. Is there any other way of checking if the VI is running on it's own or has been called from another VI?

0 Kudos
Message 1 of 3
(2,754 Views)
Solution
Accepted by topic author KevinMorse

Use the Call Chain function.  If the number of elements returned in the array is 1, then the VI is running top level.  If it is more than 1, then it is a subVI.

Message 2 of 3
(2,748 Views)

Wow that's perfect. Thanks, I knew it would be something simple.

0 Kudos
Message 3 of 3
(2,745 Views)