LabVIEW Idea Exchange

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

Fixed Iteration FOR loop option

Status: Declined

National Instruments will not be implementing this idea.

Today, if we want a FOR loop with a fixed number of iterations, we need to wire a diagram constant to N. We could probably save a few clicks if we could click on N and type in an integer directly. It would also unclutter the diagram. This should of course only work if N is unwired.

 

Of course the N-Box would grow to the right to accomodate all digits

 

To later change the loop back to "normal", we would type N into the box or simply wire something numeric to N from the left.

 

As an example how it could look like, here's a simple cross product implementation (Yes, I know, LabVIEW already has a cross-product, so this is just to show the idea!)

 

Top: current implementation

Bottom: Same code after this proposed idea has been implemented

 

 

 

26 Comments
SteenSchmidt
Trusted Enthusiast

Quite obvious conservation of BD real estate and improvement of coding style, while no loss of functionality. Kudos!

 

/Steen

CLA, CTA, CLED & LabVIEW Champion
Jokelnice
Active Participant

It would be good to see the "For Loop" this way. Maybe it would be a bit confusing for new users. But I would like to see this option someday.



Ing. Jonathan E. Cruz Ortiz

ENERGÍA PROACTIVA S.A.S

Cel : (+57) 3173669343 - (+57) 3124451894

Intaris
Proven Zealot

Aaaand when copying the for loop, the number of iterations automatically gets copied with it.  I like it.

K C
Trusted Enthusiast

Good idea. And when you resize the loop the 'iteration constant' move with it.

dthor
Active Participant

What happens when your fixed number of iterations is something like 56156? Does the box grow to contain the full number? Does it change to a symbol representing a larger-than-one-digit number?

 

What is the outcome of these two sequences? Would they even be possible?

1a. Wire from the left

1b. Enter number into N box.

Q: Does your code break? Does your manual-entry just not get implimented? Does it become some crazy "if wire is NaN or Inf then use what the user typed" kind of thing?

 

2a. Enter number into box.

2b. Wire from the left (number changes to N as per your Idea).

2c. Remove wire from the left.

Q: Does your defined iterations come back (it was "saved")? Does it stay as N and possibly break code?

 

Overall, I like the Idea. Kudos.

SteenSchmidt
Trusted Enthusiast

- I'd like the box to grow to show the entire number.

- Q1: I'd expect the wire to break, meaning the last action takes precedence.

- Q2: I'd expect that "N" stays put in this case, thus breaking the code. It would be weird if the loop structure remembered an old entry. Again, last action takes precedence.

 

/Steen

CLA, CTA, CLED & LabVIEW Champion
RavensFan
Knight of NI

Altenbach had already mentioned in his idea that the box would grow to accomodate the size of the number.

dthor
Active Participant

@RavensFan: Whoops, you're right. I missed that when I read the Idea.

Brian_Powell
Active Participant

I'll go on the record that I'm not sold on this idea.  Seems like syntactic sugar, which as has been noted elsewhere, isn't something we generally like to work on.  But keep trying to convince me!

 

Some questions...

 

Q3: Will you still be able to wire the "N" value inside the For Loop?  I assume so; I don't see any reason to disallow that.

Q4: Can I wire the "N" value outside the loop and use it as a source of data?  E.g., if I want to wire my constant N value somewhere else?  Something like this...

 

2for.png

crossrulz
Knight of NI

Purely my opinion here:

Q3: Absolutely

Q4: I would say no.  This idea is to be all intrinsic to the loop.  Wiring it to another loop seems counter-intuitive.  Or dataflow would say that loop 1 must run before loop 2.  But there would be an output tunnel for the loop.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5