01-08-2018 10:07 AM
I am attaching a Zip file which is a sample call of a Sub VI from Main VI. This uses relative paths and VI Server to load the Sub VI.
Just want to know how to do the same thing using Static VI reference. Some of the settings in that process are not clear and hence the query. I guess its far more efficient way to do this instead of with relative paths ?
TIA.
Solved! Go to Solution.
01-08-2018 10:30 AM
Have you tried the Start Asynchronous Call function? I stopped using VI Server shortly after Start Asynchronous Call was added to LabVIEW (around 2010, perhaps?). I urge you to try this:
One tremendous advantage of this scheme is that it works exactly the same whether in Development Mode or built into an executable. Here's a Snippet to admire (in LabVIEW 2016):
Bob Schor
01-08-2018 11:22 AM
Go with Bob's suggestion. The only thing I'd like to add is that instead of getting the VI Path I generally get the VI Name. The Open VI Reference works on VI Names (string) or VI Paths (path). But if the VI isn't saved then there is no path and it will only work on the VI Name. Not a big deal in a VI that is saved but for quick VIs I'm testing, I may not have saved the VI to disk yet.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
16 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
01-08-2018 10:31 PM
Thanks Bob.
Since I vaguely recalled that I have raised a similar query a few months back, I searched all my posts and could locate a post where you have posted a full project based on the static VI reference. But what kept me guessing is the fact that you had used the VI Server to get back to Main from the Sub.
Was there any reason to it or it was just done so that the difference is appreciated ?
01-08-2018 10:35 PM
Yes I too noticed it from the help file. Its a very convenient thing to just use the name of the VI.
But I was wondering what is going to happen if there are two VIs with the same name ? This can happen when developing code and we have folders with different versions of same code and invariably VI names are same. Or is it that it does not go about searching the whole disk for the name and restricts only to the specified folder ( makes sense this way )
01-09-2018 03:03 AM
@MogaRaghu wrote:
Yes I too noticed it from the help file. Its a very convenient thing to just use the name of the VI.
But I was wondering what is going to happen if there are two VIs with the same name ? This can happen when developing code and we have folders with different versions of same code and invariably VI names are same. Or is it that it does not go about searching the whole disk for the name and restricts only to the specified folder ( makes sense this way )
LV requires unique names. If you load a VI with the same name from another folder it can cause all sorts of cross reference hell. Using Path won't solve that.
/Y
01-09-2018 07:21 AM
@MogaRaghu wrote:
But what kept me guessing is the fact that you had used the VI Server to get back to Main from the Sub. Was there any reason to it or it was just done so that the difference is appreciated ?
I didn't realize that I'd already given you this better answer several months ago (but I guess you chose not to listen). I confess I didn't trash all of your code and completely rewrite it for you, causing me to overlook the use of VI Server that you reference. Sometimes when looking at code that others have written, with no opportunity to talk to them and say "What did you mean to do here, and why did you do it that way?", we focus on One Thing, try to show how to Fix That, and hope that the listener will understand and learn from the experience to fix similar problems themselves.
I apologize for the confusion.
Bob Schor
01-09-2018 07:54 AM
Bob... its me who has to apologize for overlooking the earlier post.
And just for the records .. irrespective of the impression I have created I do take all responses very seriously. After all forum support is voluntary and the person responding is investing his time on good intention to help. It demands the respect that is due.
In some cases however the recommendations cannot be implemented due to various reasons ( equipment despatched , problem solved otherwise, change in sequence etc etc )
Thanks for your support. I will now figure out how to use the Static VI reference to go back to Main.