From Friday, January 17th 11 PM CDT (January 18th 5 AM UTC) through Saturday, January 18th 11:30 AM CDT (January 18th 5:30 PM UTC), 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 local variable for control default to "write"?

I'm just curious why creating a local variable for a control or an indicator gives a "write" local variable rather than a "read" local variable. Is this most people's preference?

0 Kudos
Message 1 of 8
(2,451 Views)

I know I would prefer that the default be for a read rather than a write.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 2 of 8
(2,450 Views)

I also find I'm much more likely to read from, than write to, a local.  In fact, any variable, period.  Especially globals, because I'm only going to ever write to one once.

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 3 of 8
(2,445 Views)

It makes sense to me that write would be the default for a control, since you always need to use a local variable to write, but are able to read directly from the terminal. Definitely there are cases you want to read from a local variable for ease in programming, but it does still make sense that the default would be for what you NEED it for.

Message 4 of 8
(2,440 Views)

@prettypwnie wrote:

It makes sense to me that write would be the default for a control, since you always need to use a local variable to write, but are able to read directly from the terminal. Definitely there are cases you want to read from a local variable for ease in programming, but it does still make sense that the default would be for what you NEED it for.


Good point.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 5 of 8
(2,433 Views)

If someone knows an INI key to change this default behavior then you'll earn a kudo.  I too read more often than write.  I actually remember an API someone wrote that relied on global variables which were put on the palette (instead of it being class based) the reference was just there for the public with bold test in the description saying something like "DO NOT WRITE TO THIS GLOBAL ONLY READ"  And then as soon as you put it on your block diagram it defaulted to write.

0 Kudos
Message 6 of 8
(2,411 Views)

You'll get kudos from me, too.  I find myself saying "dang!" way more often than "thanks!" when I drop a local or global onto the block diagram.  😉

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

I also think that "write" is a good default. It is my typical case (e.g. update controls based on an ini file). I typically read from the terminal of the control directly.

 

(Ideally, unwired local variables should be "undecided", with a terminal on either side. Once we wire to/from one of the sides, it would automatically turn into read or write, depending on the connection just made. Just an idea. :D)

Message 8 of 8
(2,375 Views)