LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
altenbach

Don't skip "1" during automatic naming of copies

Status: New

This is a relatively trivial one that bugs me once in a while.

 

If we have a control or indicator (e.g. named "numeric") and make a copy of it, the new control is named "numeric 2". (followed by "numeric 3", "numeric 4" etc. if we make more copies).

 

Basically, if the label contains a trailing number, the highest existing number will get incremented by one for the new copy. 

What's wrong with this? You ask...

 

Let me explain: In labVIEW most things start counting with zero (e.g. array indices, iteration counters, etc.). For consistency, the original control should be considered "zero", so the first copy should be called "numeric 1" instead.

 

Interestingly, if we initially rename the control to "numeric 0", the first copy will be called "numeric 1" automatically. Why is "1" skipped if the original label does not end in a number???

4 Comments
AristosQueue (NI)
NI Employee (retired)

Because this is always true:

a) Normal human beings (the people for whom panel displays are presumed to serve) do not start counting at zero. Things on the diagram, where non-normal humans (aka programmers) live, start at zero. Things on panels do not.

 

and because one of two things is almost always true:

 

b) The "Numeric 2" is a temporary name that you're not going to keep anyway or

c) You're about to go rename Numeric to be Numeric 1 because you want multiple of them. 

 

If we made the second numeric be Numeric 1,  it would interfere with (c), unless you renamed your existing Numeric to be Numeric 0, which would interfere with (a).

Intaris
Proven Zealot

Well then why not append "RENAME ME - 2" and "RENAME ME - 3" and so on......  then we'll really get the message.

 

Sometimes FP control names are dictated by other factors such as hardware registers or something else they are representing and the counting really SHOULD start at zero.

 

I don't buy a) because having "Control" and "Control 2" is still wrong even if you start counting at 1.  If you forget to call the first one "Control 1" before copying, then after correcting them all (or deleting, correcting and re-copying) next time you probably won't forget.

altenbach
Knight of NI

I don't like the "..rename me..." suggestion. I have actually taken advantage of the automatic numbering by specifically naming the single element with a zero first with a good final name.

 

E.g. "Channel State 0" followed by copying to automagically generate "Channel State 1" ... "Channel State 5".

 

(Actually, Most of the time I use array controls and indicators, so that's not a common sight ;))

Intaris
Proven Zealot

Altenbach, the "rename..." suggestion was firmly tongue-in-cheek.  Should have used a smiley for that, sorry.

 

So you're saying that if a zero is explicitly entered for a control to be copied then the "1" is NOT skipped but in absence of the zero it assumed it appends a "2"?  Hmm.