LabVIEW Idea Exchange

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!
Top Kudoed Authors
User Kudos Count
8
3
3
3
2
Showing results for 
Search instead for 
Did you mean: 

Fixed Iteration FOR loop option

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

 

 

 

  • UI & Usability
25 Comments
Active Participant SteenSchmidt Active Participant
Active Participant

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

 

/Steen

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

Trusted Enthusiast Trusted Enthusiast
Trusted Enthusiast

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

Trusted Enthusiast
Trusted Enthusiast

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

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

Active Participant SteenSchmidt Active Participant
Active Participant

- 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

Knight of NI Knight of NI
Knight of NI

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

Active Participant dthor
Active Participant

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

Active Participant 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

Knight of NI Knight of NI
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.