LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Updating a control on a subvi by reference

It's been a while since I coded in Labview and I'm having a brain fart of sorts. I have a Cluster Control on a SubVi that I update through a property node via SubVIs to that SubVI. The code in these subvis are updating string rings in the first subvi from a TDMS group/channel pair. So like, imagine a user opens a TDMS file and I load all the groups into one string ring. Then they selects a group and it loads all the channels in that group into a second string ring. Well, what I wanted to do was do that process but like from a file. However, string rings have a numeric value, so they save as numbers to config files (which is how I load and store the values in the ring of strings). So to reload the ring of strings, you have to use the TDMS file. I have to first load the tdms file, then load the groups from the tdms file, select the group with the first numeric from the group ring, then load all the channels in that group with the numeric from the second string.

 

The problem is that if I don't have this SubVI's front panel open, the code doesn't seem to update the cluster's ring of strings (the values are correct but not the ring text as produced by ring text.text). I'm calling the subvi to load this data then pass it out of the SubVI, but I never open the front panel explicitly. It's hard to debug, because to debug it, I have to open the front panel, so then it works.

 

I'm just curious if there is a magic bit somewhere to make it act like the SubVI is open, or if there is another trick. Do controls on subvis not get handled the same way as top level controls? Just trying to understand it. I think I'm just gonna save the full group and channel matrix in the config file and use that, but this rubbed me the wrong way because I don't remember why this occurs.

 

I'd share code but there is a lot and it would be hard to guide you through setting it up (you need tdms files, config files, and about a dozen subvis). Hopefully this is clear enough that it clues in a knowledgeable forum goer.

0 Kudos
Message 1 of 4
(2,786 Views)

Is there a way?  Yes.  It's a bit of a hacky way to get to your solution though.  Just use the Invoke/Property nodes (I forget which and don't have LV in front of me) to open the front panel of the subVI.  There's an option to have it be hidden or minimized.  Either should work for you.

 

But, I suspect there's a much better way to do what you're doing here.  Typically the way to update something in a subVI is to wire the value in.

0 Kudos
Message 2 of 4
(2,774 Views)
So is this caused by something weird having to do with how LabView handles controls on SubVIs where they don't load front panels? I could do what you're saying but it is still pretty odd to me. I thought there might be a way in the VI properties but I couldn't find anything. Also, the code is setting up a ring of strings in the top SubVI. There is no other way to do that besides use a property node. In fact, there is a wire that goes straight from the TDMS function that generates the channels right to the Strings[] property. That's as direct as I can make it. I could merge the child SubVI code right into the parent SubVI code, but I use this function multiple times, hence why it is a SubVI itself.
0 Kudos
Message 3 of 4
(2,770 Views)

Strangely, setting it to Hidden or Minimized doesn't fix the problem. I feel like the SubVI is deferring UI updates somehow. I just wanna know whhyyyyy.

0 Kudos
Message 4 of 4
(2,757 Views)