LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot read value of referenced control, unless the control is a string

I'm programing a subvi that needs to asynchronously pull the values of some controls from its parent vi. I did it like this

JacobWilson_4-1741906937426.png

 

 

The issue is that only the string gets updated as the parent vi runs, the double never updates dt all. This is despite the fact that they are connected to the same source

JacobWilson_3-1741904740783.png

It isn't that double controls don't work at all. another control I'm referencing has its value updated just fine. But this wire is acting differently.

BTW, referencing the source control of the wire has the same issues, that's why I'm making test controls to begin with.

Does anyone have any idea why this might be the case?
 

0 Kudos
Message 1 of 7
(228 Views)

Just store all the control refs of interest in a typedef'd cluster and send them to the subVI like that.  If you want to present clean code you can always stick them in a global variable as one of the first things you do in the top level VI to be recalled inside the subVI.  I mean, you'll take a small performance hit, but compared to using property nodes, it should be unnoticeable.

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 2 of 7
(215 Views)

Hi Jacob,

 

Edit: I placed wrong content here…

 

Recommendation:

  • The purpose of FP elements is to display (or input) data.
  • You should not mis-use them to transfer data between VIs.
  • Use other ways like channels, queues, notifier, globals, FGVs, events, …
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 7
(168 Views)

@GerdW wrote:

Hi Jacob,

 

Edit: I placed wrong content here…

 

Recommendation:

  • The purpose of FP elements is to display (or input) data.
  • You should not mis-use them to transfer data between VIs.
  • Use other ways like channels, queues, notifier, globals, FGVs, events, …

Is that what they were trying to do?  It's such taboo for me that it didn't even occur to me.

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 4 of 7
(152 Views)

Your original control is either a Numeric or a String. One of your reference typecasts will fail, as you can verify viewing their error out values.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 5 of 7
(138 Views)

If it's a sub-vi, just send in the value via wire (connect the control to the connector pane)

If it's supposed to run in parallell, send/read it through any of the following; user event, queue, notification, FGV, Global.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 7
(120 Views)

It's because a string is a string, but a numeric value could be an integer, a double, etc. It's pretty unusual what you're doing (because you will get errors in an attempt to go to a more specific class), but anyway, you need strict refs, then it will work as you wanted:

snippet.png

Message 7 of 7
(108 Views)