05-23-2016 11:51 AM
I would like have my vi behave differently if the developer presses the Run button to execute the VI vs if the vi was loaded and run by another vi or executed at Run Time. Is there a simple way to do this? I tried the VI Server Reference (This VI) but couldn't find a property that gave me what I wanted.
Thanks.
Solved! Go to Solution.
05-23-2016 11:53 AM - edited 05-23-2016 11:55 AM
You can use a conditional disable structure or the App.Kind property.
05-23-2016 12:00 PM
@EduNI wrote:I would like have my vi behave differently if the developer presses the Run button to execute the VI vs if the vi was loaded and run by another vi.
Use Call Chain. If the chain array is larger than 1, the VI was called by somebody.
@EduNI wrote:or executed at Run Time.
I would use the Conditional Diagram Disable Structure for this.
05-23-2016 12:02 PM - edited 05-23-2016 12:09 PM
Thank you! Yes, App.Kind is what I was looking for. I had seen it before but could not for the like of me find it again in the LabVIEW help! Even when using the function block search or quick drop I could not find the App.Kind. The conditional disable and call chain are also potentially very useful. Thank to both replys.
05-23-2016 12:15 PM
Does call chain work if the Vi is loaded in a subpanel?
05-23-2016 01:22 PM
@EduNI wrote:Does call chain work if the Vi is loaded in a subpanel?
It will work, but maybe not as you expect it. If you are starting a new paralle execution of the VI (which I assume you are) then the call chain will show that VI has the top level. It isn't being called by any other VI directly so it will be the top level. Of course this might not be what you want. But you can use another function like the one mentioned here to detect if a VI is loaded into a subpanel and behave differently if it is.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
16 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
05-23-2016 01:22 PM
@EduNI wrote:Does call chain work if the Vi is loaded in a subpanel?
Depends how you called the VI. If you call the VI and then get a reference to it to load it into the subpanel, then yes. If you are dynamically calling it, I do not think it will work the way you want it. I will need to experiment to make sure.
05-24-2016 09:10 AM
@Hooovah, I noticed the link you provided is for LabVIEW 8.2. I wonder if there is a "more direct" way to tell if a VI is loaded in a subpanel in newer versions of LabVIEW. I am using version 2013. Thanks!
05-24-2016 12:26 PM
There is no new funtion I'm aware of to detect when a VI is in a subpanel but this is the method I've been using and works in 2015. Just make a subVI of it and throw it in your reuse library for safe keeping.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
16 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord