Home > Community > Discussion Forums

LabVIEW Idea Exchange

Showing results for 
Search instead for 
Do you mean 
We've turned on a search before post feature in the LabVIEW Idea Exchange. This new feature will help cut down on the number of duplicate ideas in this space!

The NI Idea Exchange is a product feedback forum where NI R&D and users work together to submit ideas, collaborate on their development, and vote for the ones they like best. View all of the NI Idea Exchanges to post an idea or add your opinion on an existing one today!

Fixed Iteration FOR loop option

Status: New
by Knight of NI Knight of NI on ‎02-15-2013 05:15 PM - last edited on ‎02-16-2013 05:55 PM by Community Manager

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




by Active Participant SteenSchmidt Active Participant
on ‎02-17-2013 08:21 AM

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



by Active Participant Jokelnice
on ‎02-18-2013 01:11 AM

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.

by Trusted Enthusiast Trusted Enthusiast
on ‎02-18-2013 05:05 AM

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

by Trusted Enthusiast
on ‎02-18-2013 07:18 AM

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

by Active Participant dthor
on ‎02-18-2013 10:25 AM

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.

by Active Participant SteenSchmidt Active Participant
on ‎02-18-2013 01:48 PM

- 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.



by Knight of NI Knight of NI
on ‎02-18-2013 07:39 PM

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

by Active Participant dthor
on ‎02-19-2013 10:23 AM

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

by Active Participant Brian_Powell
on ‎02-20-2013 08:47 AM

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...



by Knight of NI Knight of NI
on ‎02-20-2013 08:51 AM

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.

About LabVIEW Idea Exchange

Have a LabVIEW Idea?

  1. Browse by label or search in the LabVIEW Idea Exchange to see if your idea has previously been submitted. If your idea exists be sure to vote for the idea by giving it kudos to indicate your approval!
  2. If your idea has not been submitted click Post New Idea to submit a product idea to the LabVIEW Idea Exchange. Be sure to submit a separate post for each idea.
  3. Watch as the community gives your idea kudos and adds their input.
  4. As NI R&D considers the idea, they will change the idea status.
  5. Give kudos to other ideas that you would like to see in a future version of LabVIEW!
Idea Statuses
Top Kudoed Authors