LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help comparing the value of a button using the Property Node (I get a variant)

Dear Sirs:

(I'm using LabView 6. I guess the solution is different for 6.1)

Currently I have created an array of Boolean RefNums (which point to many, many buttons). When I need to know when any (and which) of the buttons was pressed I just compare every element on the array with the constant TRUE. It fact, as the array is built from RefNums, I should compare the VALUE from the Property Node.

The problem here is that the Property Node for this type of Boolean is a LV Variant, and I need to compare this with a TRUE/FALSE value.

I tried to convert the TRUE constant to a LV variant and visc. But nothing works... I always get that none of the buttons was pressed.

Here it co
mes the question: "How can I compare the value of a Property Node for a Boolean (Button) with a TRUE (or False) constant?"

BTW, maybe I should explain why I'm using RefNums instead of the direct values: As my project requires tons of buttons, I would preffer using RefNums to refer to them. (I.E. I could use a single VI that takes the RefNum and formats the button to hide it for certain users).

I have enclosed a VI that contains what I've achieved until now, which is nothing 😉

I appreciate your time and help.

Best regards,

JAVIER VIDAL
Mauricio Vidal
VIDAL & ASTUDILLO Ltda.
http://www.vidalastudillo.com
0 Kudos
Message 1 of 5
(2,824 Views)
Your mistake was that you converted boolean to variant.
You need convert variant to boolean.
Look attached example.
Message 2 of 5
(2,824 Views)
Thank you Nadav...
The error mentioned on Mr. Drolet's answer was causing me the confussion about the way the variant should be converted.
Thank you again!

JM
Mauricio Vidal
VIDAL & ASTUDILLO Ltda.
http://www.vidalastudillo.com
0 Kudos
Message 5 of 5
(2,824 Views)
Javier,

There is another problem in your code: the booleans are not polled by the main loop so they will remain false until the user presses them again. This renders the boolean latch action useless.

What you can do is to change the mechanical action of the booleans to non-latch. When you detect a "true" in the polling loop, set the boolean to false again. One added benefit is that once all boolean are non-latch, the value property won't be a variant but a boolean so conversion is no longer needed.


LabVIEW, C'est LabVIEW

Message 3 of 5
(2,824 Views)
Jean-Pierre:

Thank you! I think I got the idea of the latching action and the Variant Types�

About the error polling the booleans... there is not much to say... I was so blind to see it... Thanks again!

Regards,

JAVIER
Mauricio Vidal
VIDAL & ASTUDILLO Ltda.
http://www.vidalastudillo.com
0 Kudos
Message 4 of 5
(2,824 Views)