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
Showing results for 
Search instead for 
Did you mean: 

A better way to define the output of unwired output tunnels

This one of my very old ideas and goes all the way back to InfoLabVIEW. I recently got reminded in this thread to write it up as an idea. You might have heard it before. If not, read it Smiley Very Happy)


Currently, an output tunnel gets the default value for the given datatype if "use default if unwired" is enabled and a case executes where it is not wired. Recently, we also got the "linked tunnels" feature, which is more like an editing assistant.


Many times we have a big stack of cases but the computation of many outputs is shared by many cases, maybe with one or two notable exceptions. Smiley Wink It would be cool to be able to define this shared "default" code only once so it is executed unless we create an exception case.


My suggestion is to have a new, special case that allows us to define the output of each tunnel for cases where it does not receive an overwriting input.


The image shows a few possibilities for an event structure (same applies for all other relevant structures).


A: A reference is wired across by default. We don't need to wire across any other case.

B: Nothing is defined, so it acts like today. This is the default, so everything is automatically backwards compatible with existing code.

C: A number is incremented with each iteration unless we overwrite in a specific case

D: The default output is based on the operations of several inputs.

E: If a tunnels is unwired, we get NaN (or whatever we need) instead of zero. For I32 me might want -1, for example.

F: Same as A. This is similar (but not exactly the same) as linked tunnels. (I.e. It also applies to existing unwired cases)

G: This tunnel is defined in all cases. If we add an unwired case later it would act like B.

H: (not shown): certain global event terminals (e.g. time) should also be available in the "default definition case", because we might want to utilize it for a default output.



 Downconversion would be somewhat messy. It would probably need to wire the relevant default operations into all cases where an output is not wired, keeping the functionalty the same.

Message Edited by altenbach on 07-11-2009 10:45 AM
Active Participant

Great idea, though it does make it more difficult to know what will happen at an unwired terminal without looking at the Defaults case. I especially like being able to do E & A, but C or D could prove confusing for a while! I would suggest two enhancements:

- a different unwired box signifying that the default behaviour is not the "default" behaviour.

- a mouseover on an unwired box could overlay (semi-transparently?) the Defaults case temporarily, or some other popup of the new action.


Trusted Enthusiast
I'm split on this one.  One one hand I can appreciate the idea but on the other I can only think it decreases the readability of the code....
Proven Zealot

Looking at case G, it seems like there needs to be some way to say, "There is no default. You must wire this in every case." I'm thinking of the state transition enum that often occurs in state machine diagrams -- whatever state you're in, that state is responsible for specifying its next state. Having a default state defined would seem more likely to lead to "I forgot to wire that" errors, since you'd no longer have a broken VI. Do others agree with me? If so, what would we add to the diagram to indicate "this tunnel has no default"?

Knight of NI
G is just dark because it is wired in all regular cases. If we would add a regular case where it unwired, it would automatically look like B. For people that never use this idea, and for legacy code, things will look as always. (Sorry, posting via phone...)
Knight of NI
Maybe we could add for clarity the following: If we hover directly over a shaded tunnel, and the currently visible case is unwired for that tunnel, the case code should momentarily bleach and the default code Leading to that tunnel show instead (maybe elevated with a drop shadow).
Knight of NI

I'm with Intaris on this one..


It would be okay if you could turn off the "Ouput Tunnel Defaults" feature.

I'm worried about novice programmers who would not have a clue about the proper use of this feature.

Or old guys that forget those new features, or suddently jump from LV7.1 to LV2012.


I'm not yet sold on this one...


Perhaps doing it this way hides important functionality in a special case users may not know exists. Moreover, does this special case execute before, after, or simultaneously with the actual case it is trying to execute? Naturally, it should be simultaneous but then you get into debugging questions about how to best represent that at runtime.


I believe this related idea does a better job displaying this behavior:

Trusted Enthusiast

alejandro5042 wrote:


does this special case execute before, after, or simultaneously with the actual case it is trying to execute?

This case does not execute - it's a "dummy" case that stores "macros" to define the action the compiler should fill in for unwired linked input-output terminals. Note how the event banner does not have a case number in it (just says "Output Tunnel Defaults") and the background of the "case" is greyed.

Wirebird Labs: Expert Toolkits for LabVIEWDeploy, by Wirebird Labs: Expert Toolkits for LabVIEW
Knight of NI

>  I'm worried about novice programmers who would not have a clue about the proper use of this feature.

> Or old guys that forget those new features, or suddently jump from LV7.1 to LV2012.


If you study all this once more, you'll see that this is of absolutely no concern. Everything will look and act exactly as before. There is no additional case plugging up the thought process when we flip through the cases, unwired output tunnels get the default for the datatype, etc.


Unless you willfully use this feature, it is completely invisible! Only once customized defaults are used for output tunnels, the tunnels might take a slightly different look to show that we are not in Kansas anymore.


We only see that "special" case if we right-click and say "define unwired outputs" or some other mechanism, e.g. press a little button in the upper right corner of the case/event structure. Once we are happy, we [x] out of it. (lets place a grey x in the upper right corner!). Maybe we could also go to that case when we double-click an output terminal, for example. Exact UI mechanics to be determined and improved.


As I said before, often the current default behavior for unwired tunnels is not what I want. For DBLs I often would like an NaN. Other related suggestions cannot do "math", e.g. base the default output on the result of several inputs.


Many times cases share a lot of code that needs to be repeated in each case, just because one or two cases are slightly different. Wouldn't it be more economical to define the common code exactly once. Much less error prone, much more maintainable. A single change is sufficient if we need to modify the common code.


Personally, I still really like this idea! Smiley Very Happy (not just because it is mine Smiley Wink)

Knight of NI

Thanks for the additional explanation.  I may have to read it again so that it sinks in..  It "clicked" in my mind..  Okay... It is different from what my brain had understood.  With the additional details, my scale went towards "I like it & I could use it".  So kudos..


It is basically like having a state machine with an initialization state where if the output of the tunnel is unwired, instead of going to the default value for that type, it defaults to the value from the initialize state.  Yes.  This I like.  And it is more versatile than the other suggestion that I read..


Thanks Christian.


Smiley Happy