LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Same name for different controls

How LabView resolves name conflict when  two indicators or controls  are with same labels .In C declaring different variables is impossible,

 

as this will throw the compiler error?

0 Kudos
Message 1 of 7
(3,407 Views)

I think how LabVIEW resolves the conflict is not important if you stop thinking of controls & indicators as variables.  Use the wire as the variable and there's no confusion.  I believe, however, that how LabVIEW resolves the conflict is indeterminate.

 

You shouldn't use the duplicate labels, anyway, use the object's caption instead.

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Message 2 of 7
(3,395 Views)

@JeyZ wrote:

How LabView resolves name conflict when  two indicators or controls  are with same labels .In C declaring different variables is impossible,

 

as this will throw the compiler error?


With the exception of the Invoke Node Set control value method, LV does not depend on the controls name. It makes it hard for the developer when they have the same name but LV really does not care.

 

BTW: The previous post about not thinking about controls and indicators as variables is important when trying to understand how LV works.

 

"The wires are the variables."

 

If you still are using ideas from C that depend on you having names for each variable, then drop a free lable on thediagram near the wire to help you out. Eventually (if you are like me) you'll not need teh lables anymore.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 3 of 7
(3,369 Views)

Whatever you call a variable, be it the wire or the control, LabVIEW should not allow duplicate labels.  When you copy a control and paste a duplicate, it adds a 2 after the label.  So even Labview won't duplicate the label.  Why would it allow a user to do so.  I know that Labview doesn't care, but lets make this a bit more user friendly shall we.  Users use labels and refer to labels (or captions) to identify variables.  Its a throwback to text based programming, but the notion will not ever go away.  I've been using LV for over 10 years and I sitll rely on labels and captions to identify variables.  A wire is variable, a control is variable, an indicator is variable.  They all can have their values changed.  Therefore they are all variables by definition.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 7
(3,349 Views)

@tbob wrote:

Whatever you call a variable, be it the wire or the control, LabVIEW should not allow duplicate labels.  When you copy a control and paste a duplicate, it adds a 2 after the label.  So even Labview won't duplicate the label.  Why would it allow a user to do so.  I know that Labview doesn't care, but lets make this a bit more user friendly shall we.  Users use labels and refer to labels (or captions) to identify variables.  Its a throwback to text based programming, but the notion will not ever go away.  I've been using LV for over 10 years and I sitll rely on labels and captions to identify variables.  A wire is variable, a control is variable, an indicator is variable.  They all can have their values changed.  Therefore they are all variables by definition.

 


Why?

 

Not being in the design meeting we can only specualte but I would think "Why not?" It does not hurt anything, besides, it is a bit of an eye-opener for text coders to get them thinking that there is something differnet about LV.

 

Done speculating.

 

Ben

 

PS: I avoid duplicate names.

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 7
(3,339 Views)

@Ben wrote:

Why?

 


To help the user avoid making a blunder.

 


@Ben wrote:
"Why not?"

To help the user avoid making a blunder.

 

I need all the help I can get.

 

PS:  I don't use duplicate names either, but I have inherited some code where a duplicate name was used.  Very confusing.  There was a property node.  Which control did it belong to?  "Numeric" or "Numeric"?  Of course it was easy to find by right clicking and selecting Find Control.  But this should not be allowed.I don't want to have to think more than I already have to.  I'm lazy.

 

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 6 of 7
(3,322 Views)

 


@JeyZ wrote:

How LabView resolves name conflict when  two indicators or controls  are with same labels .In C declaring different variables is impossible,


 

Each object has its own reference.  Whether it is a wire or a control.

So if two objects have the same name (ie two controls called Numeric), they have their own unique reference designator.  That is how LabVIEW keeps track of each object.

0 Kudos
Message 7 of 7
(3,317 Views)