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
Highlighted

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

 

bool.png

 

 

-------------------------------------------------------------------
Unfortunately, most readers of this Forum, including some real Experts, have not mastered the skill of being able to read the code that Posters fail to post. If we cannot see "what you did wrong", we are unable to tell you how to fix it. (Bob Schor 28 August 2018)
0 Kudos
Message 1 of 10
(691 Views)
Highlighted
Solution
Accepted by topic author RTSLVU

Latch action


LabVIEW Champion. It all comes together in GCentral GCentral
Message 2 of 10
(686 Views)
Highlighted
Solution
Accepted by topic author 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
Message 3 of 10
(682 Views)
Highlighted

Thanks, I see that now.

 

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

-------------------------------------------------------------------
Unfortunately, most readers of this Forum, including some real Experts, have not mastered the skill of being able to read the code that Posters fail to post. If we cannot see "what you did wrong", we are unable to tell you how to fix it. (Bob Schor 28 August 2018)
0 Kudos
Message 4 of 10
(678 Views)
Highlighted

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
(610 Views)
Highlighted

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
(564 Views)
Highlighted

@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! 😛

-------------------------------------------------------------------
Unfortunately, most readers of this Forum, including some real Experts, have not mastered the skill of being able to read the code that Posters fail to post. If we cannot see "what you did wrong", we are unable to tell you how to fix it. (Bob Schor 28 August 2018)
0 Kudos
Message 7 of 10
(559 Views)
Highlighted

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
(555 Views)
Highlighted

"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
(543 Views)
Highlighted

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.


LabVIEW Champion. It all comes together in GCentral GCentral
0 Kudos
Message 10 of 10
(528 Views)