LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

subvi access label of input wire

Hi

 

is there a way to access the name/label of an input wire connected to a vi (or an XControl for that matter)?

 

as an example: I would like to have an vi that takes a double as input and returns a string with "The wire with the label %s has the value %f".

 

Up to now I had to use two inputs and wire the double into one and the output of the openG function "get data name" to the other. Works too, but I would like to move the functionality into the subvi if possible.

 

Thanks

 

Arun

0 Kudos
Message 1 of 6
(2,862 Views)

Good Afternoon Arun,

 

I have attached a VI along with a SubVI that is called within that VI that does what I believe you are trying to accomplish.  I hope this helps!

 

-Cody C

0 Kudos
Message 2 of 6
(2,839 Views)

This is similar to what I want, but not exactly it. I would like to use only one input and if possible be able to use the wire I want directly and not use a reference to it.

 

One reason for this is that I want to be able to use this in a XControl-indicator which only can have one input AFAIK. I know that I could get around it by just adding a property node for the name of the wire to the XControl, but then I always need to change things at two places in the code and I rather would avoid that... It also would need more space on the block diagram...

 

Another reason is that I would like to use it on wires that have a label in labview, but are not necessary indicators or controls, in which case I'm not sure if you can get a reference or a property node from them... say I have a cluster of data and then use uncluster by name to access one of them and would like that to be plugged into the subvi (see example.vi in attachement; uses openG... this also doesn't do exactly what I want, since when I change the label of the wire, it still puts out the name of the control).

 

I'm not that familiar with references though, is there a way to programatically get a reference (e.g. a vi that has double in and a ref to that double as output)? In that case I could modify your vi, so that it only takes a reference as input (and uses the value property inside to access its value, see modification of your vis in the attachment): and then would use

 

double->vi: input to ref-> vi: name+value to string

 

I guess my question is, if you can access any attribute apart from the value of an input of a subvi?

 

cheers

 

Arun

0 Kudos
Message 3 of 6
(2,830 Views)

Good Afternoon Arun,

 

So I don't believe that you will be able to use only one input.  This is because your two inputs are of different types.  I believe your best option will be to set it up like it is in the example I sent you with a SubVI.  I hope you have a great rest of the day!

 

-Cody C 

0 Kudos
Message 4 of 6
(2,814 Views)

Cody C wrote:

[...]So I don't believe that you will be able to use only one input.  This is because your two inputs are of different types.  I believe your best option will be to set it up like it is in the example I sent you with a SubVI.[...]


Hi Cody

 

with your idea of using a reference as input to the subvi, you can reduce the inputs to only one wire, since you can also access the value of the variable from the reference (in the same way you access the label.text). The only way to get a reference I know of is though to right-click on a control or indicator block element... are there other ways to generate a reference?

 

thanks

 

Arun

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

Good Afternoon Arun,

 

Good point, you are right that you can reduce it to one wire since you can access the value of the variables from the reference.  Another way to open a reference is to go to the Functions palette->Programming->Application Control.  Within this palette is where the function to open the reference is.  I hope this helps!

 

-Cody C 

0 Kudos
Message 6 of 6
(2,792 Views)