01-04-2012 06:28 PM
Dear all,
I have a VI that calls a subVI which, in turn, calls a subVI. I would like the final subVI to get the reference of the first, top most, calling VI. The call chain function will not work as it returns neither a reference or a path, only the file name. I would prefer not to pass the reference to each VI, rather I would like the final subVI to get the reference (or path and name) of the top most VI. Any ideas?
Thanks.
01-04-2012 06:44 PM
I would use an Action Engine or Functional Global Variable to store the reference to the top level VI when it first runs. With that, you can retrieve the reference in any VI.
01-04-2012 09:40 PM
Call Chain will return an array of strings of the names of the VIs. The last element is the top most VI. Then use Open VI Reference to get a reference of the top most VI. You can just feed to string from the last element into the VI path input of the Open VI Reference.
01-05-2012 07:57 AM
Both mar and Bill have offered good and proper answers to your question. To help distinguish...
Omar's solution is classic KISS and if it serves your needs then go with it.
If you app is likely to get a bit more complicated and if there is the possiblity of having to use multipl threads doing background tasks that require interaction with the GUI then I lean toward Bills suggestion. YOu can see some examples of utilizing the Action Engine to allow access to the GUI in the images I have in this gallery. Note: The images have inks to the original threads if you have follow-up Qs.
Ben