LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a property node if a VI is a main or sub?

My apologies, but I didn't want to clutter up the subject board with the long winded full question.  But it is this:

 

Is there a property node (or other means or method) to determine if a VI was launched as a sub VI (call by another main VI) or as a main VI itself?  With the never ending goal of code reusability in mind, I wrote 3 VIs (more to come) that can either run stand alone as a main VI, or be called as by a separate main VI.

 

My issue is that I've got to setup connections for a db when used as a sub, or simply pass them to the VI when a main.  I'm using a sub panel structure, so I can't just wire a boolean value to a VI connector.

 

It also seems that I have an issue passing a value to the sub VIs via the vi server function of an invoke node with "contol value set".  I'm working that through on this discussion  ( http://forums.ni.com/t5/LabVIEW/Trouble-passing-values-to-subpanels/m-p/1582524 ).  If I could just pass a value to the VI from the main, then I can determine if it is a sub or main that way.  But so far I'm having issues with that.

 

So is there any other way?

0 Kudos
Message 1 of 6
(2,720 Views)
Check out the Call Chain function
0 Kudos
Message 2 of 6
(2,719 Views)

... and also the Docking Example I posted here.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 3 of 6
(2,715 Views)

VI properties:

  1. "Exec.State" check to see if it is "run top level".
  2. "Callers" Check to see if the VI has any callers, IE empty array indicates that NO VIs are calling it, but does not reflect dynamic calls.

Paul
0 Kudos
Message 4 of 6
(2,706 Views)

Thanks.  Good features to know about, but doesn't quite get me there with the dynamic calls of the subpanels.  Looks like I need to get my Value (signal) data passing working.

0 Kudos
Message 5 of 6
(2,687 Views)

Without being sure what your doing, you could make it reentrant and use the the VI property 'isClone?', then when you dynamically call it (make sure that your open vi reference has an x8 for options), you can use that to determine if it was copied at launch, but I only did a quick test using this and without knowing the full implementation, it may or may not work for your purposes.


Paul
0 Kudos
Message 6 of 6
(2,670 Views)