LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Open VI Reference Cant find Control

Solved!
Go to solution

Unless...

 

Starting from the beginning, I am running LV2009. I am opening a reference to a functional global VI running on a remote computer to get the value that is in its' front panel indicator. I have two problems. The first is that when I use a string containing the VI name, it will not find the VI. When I use the full path to the VI, the Open VI Reference works fine. Annoying, but doable, as I only have about six FG to read and they are all saved in the same folder.

 

Second problem, and the real reason for the post: I can get all control values as a variants without trouble by using Ctrl Val. Get All Method. But when I try to name a control in the (Ctrl Val. Get) Method, I get an error saying control can't be found.

 

SO, I used property nodes to get the label text and checked to see if any were equal to the name of the control I am trying to read. It came up negative. So I created a list of the labels off of the Label. Text property node, and there sits the name I just checked for. So I copy and paste this back into the constant that is wired to the Control Name input on the Ctrl. Val Get Invoke Node, and no error. What the ??? So then I delete the text that I pasted into the constant and retype and it still runs fine.

 

I checked and rechecked enough to know that I was not typing the name in wrong, but now it works fine. I can close the VI and reopen it, works fine. Type in the name again. Still works fine. Any thoughts?

0 Kudos
Message 1 of 6
(3,025 Views)

Hi deskpilot,

can you reproduce this behaviour? Maybe you had some special chars in your constant.

 

Mike

Message 2 of 6
(3,001 Views)

 

Is the VI a member of a library? If it is, then you have to use its fully qualified name to open a reference (e.g. myclass.lvclass:myVI.vi). If you use the path you don't need it, because the VI knows which library owns it.

 


deskpilot wrote:

Any thoughts?

I would also guess that the constant had something wrong with it (like a space or a null character incorrectly assigned). It might have even gotten corrupted on its own.


___________________
Try to take over the world!
Message 3 of 6
(2,991 Views)
Solution
Accepted by topic author deskpilot

deskpilot wrote:

Unless...

 

Starting from the beginning, I am running LV2009. I am opening a reference to a functional global VI running on a remote computer to get the value that is in its' front panel indicator. I have two problems. The first is that when I use a string containing the VI name, it will not find the VI. When I use the full path to the VI, the Open VI Reference works fine. Annoying, but doable, as I only have about six FG to read and they are all saved in the same folder.

 

Second problem, and the real reason for the post: I can get all control values as a variants without trouble by using Ctrl Val. Get All Method. But when I try to name a control in the (Ctrl Val. Get) Method, I get an error saying control can't be found.

 

SO, I used property nodes to get the label text and checked to see if any were equal to the name of the control I am trying to read. It came up negative. So I created a list of the labels off of the Label. Text property node, and there sits the name I just checked for. So I copy and paste this back into the constant that is wired to the Control Name input on the Ctrl. Val Get Invoke Node, and no error. What the ??? So then I delete the text that I pasted into the constant and retype and it still runs fine.

 

I checked and rechecked enough to know that I was not typing the name in wrong, but now it works fine. I can close the VI and reopen it, works fine. Type in the name again. Still works fine. Any thoughts?


A trailing space in your original constant fits that problem description.

 

May be helpful...

 

If you know the data type of the data you are reading using the val prpererty node, you can use the "TO more specific" node to cast your refences to the proper type. After doing so your val will not be a variant and you can use the standard LV operators to work with the data.

 

Ben

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

To the first problem of not being able to use the string to find the VI: The VI is part of a project but not a library. I tried using the My Project.lvproj/My Computer/My VI.vi format in the string constant with no luck. After thinking about it a bit, I will actually only need one VI call. I was calling multiple FG readers. All of the information is being written by a single writer. I just never made the wrapper for all of the readers (like Ben suggested a long time ago when I was working on that originally), so I will do that now and only have to make the one VI call.

 

As for the other problem, I know I checked and retyped a half a dozen times that I was using the correct syntax for the control label, but I cannot reproduce the behavior even when starting with a blank VI. I will assume that I am challenged and didn't notice the space at the end like Ben suggested, and I will also look at using the TO more specific node to ease my troubles.

 

Thanks for all of the help and suggestions.

 

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

deskpilot wrote:

I tried using the My Project.lvproj/My Computer/My VI.vi format in the string constant with no luck.


It wouldn't work as it has no meaning. A library is a container of VIs and is part of their full names. A project is simply a way of organizing things and there is no direct relation between the VI and the project (other than that the project calls the VI).

 

One thing to look out for, though, is where the VI is. When you use a string, LabVIEW already has to have the VI in memory in the correct application instance. An application instance is a memory space and the simplest way of knowing which instances you have is considering each target in a project to be a separate instance (so the My Computer in one project and the My Computer in another project which are open at the same time are TWO separate instances).

 

The instance used by the Open VI Ref primitive is determined by its Application input.

If it's unwired, it uses the same instance the VI calling it is in (so you need to have the VI in the same project as the other VI AND the other VI needs to be open).

If you want to connect to another instance, you need to use Open App Ref primitive and give it a machine and port name.


___________________
Try to take over the world!
0 Kudos
Message 6 of 6
(2,949 Views)