From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why does a Boolean Control property node input and output a Variant instead of a Boolean?

Solved!
Go to solution

Why does a Boolean Control Value and Value (signaling) property node input and output a Variant instead of a Boolean?

 

bool.png

 

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 1 of 10
(2,958 Views)
Solution
Accepted by RTSLVU

Latch action

Message 2 of 10
(2,953 Views)
Solution
Accepted by RTSLVU

As Christian said, if your Boolean control is set to one of the Latch mechanical settings, the value property is a variant.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 10
(2,949 Views)

Thanks, I see that now.

 

I don't use a lot of locals or property nodes and never noticed this before

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 10
(2,945 Views)

While I'm aware the mechanical action settings of a boolean lead to this, I feel like this is still weird behaviour.

 

Does anyone have a link to a discussion as to WHY it's neccessary at all to output a variant as opposed to a Boolean value? It seems like the datatype of the returned data is irrelevant in this regard.

0 Kudos
Message 5 of 10
(2,877 Views)

All right, I have to say it.  Google is your friend.  😄

 

I googled: "labview why latching boolean is variant" - first hit.

Spoiler
It's so you know you're doing something bad.

 

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 6 of 10
(2,831 Views)

@billko wrote:

All right, I have to say it.  Google is your friend.  😄

 

I googled: "labview why latching boolean is variant" - first hit.

Spoiler
It's so you know you're doing something bad.

 


Now that makes sense! 😛

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 7 of 10
(2,826 Views)

Older versions of LabVIEW will throw a runtime error if you insist on doing it, and it says so in the help.  But in newer versions, that tidbit is deleted from the help.  Does that mean it no longer throws an error?

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 8 of 10
(2,822 Views)

"Why" questions are hard to answer unless we are in the room when the decision was made...

 

Could have to do with Latch Action terminals will change the state of the Boolean but a property node will not.

 

We also cannot use a local to write to a latch action Boolean.

 

That is all that comes to mind at the moment.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 9 of 10
(2,810 Views)

Well, latch booleans reset when read by the code but it probably would be unpredictable if reading in multiple places via property nodes would each reset it. Locals aren't even allowed, while value property nodes will give you a runtime error, so the variant can never have inspectable data. So yes, seeing a variant as boolean value property means (Bad, not a boolean, don't use)

 

Same for writing to secondary terminal (local, value property). What should happen if you write if the button has already been pressed but not yet read? Many other scenarios. Can of worms!

 

Of course you might argue that writing a signaling property is more similar to actually pressing a button, so read this discussion for some perspectives.

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