LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Different Results VIM and subVI

Solved!
Go to solution

I want to use the Variant data parsing tools to find the name of a control or indicator. The code is simple. See below.

 

Snap6.png

If the code is run in the subVI I get the correct result. If run in the VIM I get the name of the VIM Control. If I try to use the subVI in a VIM, I get the name of the VIM control.

 

Can somebody let me know why this doesn't work in a VIM?

 

Thanks

mcduff

Download All
0 Kudos
Message 1 of 10
(2,609 Views)

Interesting...The tool works on an element inside a variant, but in the VIM, the variant is formed (by coercion at the input terminal of the tool) after passing trough the generic connector named "variant", so the content has the name of the input terminal

 

The VIM operates on the value of the control and the label is not part of the value. In the subVI version, the coercion to variant happens at the input, so the name is part of the variant data.

 

OTOH, This works:

altenbach_0-1591296688130.png

 

Message 2 of 10
(2,590 Views)

It's interesting that one case works. However, for my end solution it will not work.

 

I wanted to wire different values to a configure file, have it automatically get the name of the control and write. I know there exist some variant solutions, I thought I could be clever and write a VIM.

 

Attached is the VIM, but you would need to rewire the name to make it work, otherwise all the names are "Value In". The Get Name from variant doesn't work as you noticed.

 

Snap7.png

Thanks

mcduff

0 Kudos
Message 3 of 10
(2,562 Views)
Solution
Accepted by topic author mcduff

You might be interested in the long conversation on this idea (which is to make VIMs work the way you want).  The idea was declined because NXG is eliminating wire/variant names entirely, making none of your solutions work, and so they want to discourage you developing code like this.

Message 4 of 10
(2,550 Views)
Solution
Accepted by topic author mcduff

I still think that the current behavior is absolutely correct and is, as mentioned, caused by the difference where the coercion to variant occurs.

 

  • In the subVI, the variant is created by coercion on the main diagram before the subVI gets it.
  • in the VIM, the variant is formed later, because the VIM initially retains the data as a DBL value. It cannot know what the original terminal name on the main diagram was.

I don't see any valid workaround.

Message 5 of 10
(2,545 Views)

The other possible solution is to read the threads more closely. 😁

 

mcduff

0 Kudos
Message 6 of 10
(2,534 Views)

Update

 

I think I found a Rube-Goldberg solution; @altenbach if you want to cross post it to the official R-G thread feel free. I have no idea if this work around will work in future versions.

You need to bundle the control you want in a single element cluster.

The VIM now looks like this:

 

snip.png

 

An example is shown below (See how the string is put into a cluster):

 

snip.png

 

Not ideal but working at the moment. Thanks for everybody's help.

 

mcduff

 

 

0 Kudos
Message 7 of 10
(2,488 Views)

@drjdpowell wrote:

You might be interested in the long conversation on this idea (which is to make VIMs work the way you want).  The idea was declined because NXG is eliminating wire/variant names entirely, making none of your solutions work, and so they want to discourage you developing code like this.


So they're dumbing down LabVIEW NXG for the masses and LabVIEW Classic is paying for it.  I guess this is why OpenG NXG support stopped at NXG 3.0 and MGI Tools stopped at NXG 2.0.  I imagine this particular change broke about 1/3 of their tools.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 8 of 10
(2,472 Views)

@mcduff wrote:

Update

 

I think I found a Rube-Goldberg solution; @altenbach if you want to cross post it to the official R-G thread feel free. I have no idea if this work around will work in future versions.

You need to bundle the control you want in a single element cluster.

The VIM now looks like this:

 

snip.png

 

An example is shown below (See how the string is put into a cluster):

 

snip.png

 

Not ideal but working at the moment. Thanks for everybody's help.

 

mcduff

 

 


Yep.  I came up with a similar "variant" to that solution.  It's going to be a pain to maintain (which was what I was referring to in a post of mine, which was a "variant" of this one) because you will have to update everything manually, should anything change.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 9 of 10
(2,470 Views)

@mcduff wrote:

You need to bundle the control you want in a single element cluster.

 

snip.png

 


Your input of a cluster of one element will work in NXG, as you will be able to get cluster element names; however, creating your cluster with a bundle will NOT work.  Wires don't carry names, and so the bundle will contain an element named "Element 1".  To get "My Control Name" you will have to create a cluster constant and manually configure the right name (and type), then bundle-by-name the value.

0 Kudos
Message 10 of 10
(2,452 Views)