LabVIEW Idea Exchange

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

Integrate Close Reference into the Property Node

Status: New

The Close Reference –VI could be integrated into the Property Node ore the invoke node.

a.png 

I would recommend that the reference output could be activated or deactivated.

 b.png

A deactivated reference output

  • would change its appearance
  • would close the reference immediately after a the call.

An activated reference

  • should require a connected wire on its output. Otherwise an error should be indicated (somehow).

c.png

My comments  

  • An integrated Close Reference –Function would simplify the code and improve the readability.

     

  • The output should be changeable in the context menu / pop-up menu of the Property Node.

     

  • The default state needs to be discussed. I would recommend to close it by default. Sometimes it is not necessary to close the reference – it would lead to a void operation --> so what? Sometimes it is required to close it later. I think in this case you would find it out after the first run of your vi.
  • Usually it would not mater if somebody would let some references open. LabVIEW closes open references finally. But if an application should run for several days, left open references could lead to problems. Because of this I think that it is better to close to often than left some references open.
  • I am not sure how LabVIEW should react if an activated reference output would not be connected. I would recommend to indicate an error. In my opinion this would be an additional new feature to LabVIEW. LabVIEW does check inputs only. But this is another problem to discus.
  • Perhaps there are other places / VIs to implement an auto-close reference output.
8 Comments
X.
Trusted Enthusiast
Trusted Enthusiast

That sounds like a good diagram clutter solution. I would prefer something a bit more visually striking than your tiny black "x". Maybe a large red "X" or some very visible color scheme change?

Note that this suggestion could very well be extended to file ref nums, DAQ tasks, etc, although in these cases (but maybe as well in the examples described in the suggestion as well?), there is a lot to do to actually "close" the reference cleanly... Not sure whether NI will want to add that complexity to their existing functions... Smiley Happy

GregSands
Active Participant

I like this.  Regarding the default, I agree it should default to closed (when you drop the node), however, if you wire to the output, then of course it reverts to open - that way you usually don't need to set it at all.

Darin.K
Trusted Enthusiast

I'd probably prefer a smaller Close function with terminals that align with the PN/IN.  You could even add it to the Right-Click pull menu, Create -> Close Reference and have it dropped and autowired.

 

The Close function has non-standard error handling, the IN/PN do not.  Probably not a big deal, but the more exceptions there are to the rules, the more I have to read the manual...

 

What I would really like to see to make up my mind is a set of rules (think KB article) about which references *really* need to be closed explicitly.  I have found some scattered information, and using that I find that I do not have an unruly number of explicit close operations.  Enough that I would certainly like them cleaned up a bit (smaller node), but unless there is a need to close nearly all references I would lean against making the Close function too hidden.  (Color is out as a distinguishing factor).

ReneW
Member

Darin.K

I agree. The Close Reference VI should be smaller. Therefore I started added an additional idea see 'Reduce the size of the Close Reverence VI'

Mark_Yedinak
Trusted Enthusiast

While this is an intriguing idea I would recommend it is declined. I feel the code reads better and is overall easier to understand when you see the specific Close on the BD. In larger code blocks I think it would be very easy to overlook an automatic close. If implemented though the reference should NEVER be closed if the output is wired. That would be a recipe for disaster.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
gbecker
Member

I would always vote for explicit reference handling.

 

X.
Trusted Enthusiast
Trusted Enthusiast

It would be easy to add "unclosed" references to the warning list.

The close reference function definitely goes in the way of clean wiring when you use the property node to obtain a reference to a child object:

 

ScreenHunter_001.jpg

 

versus this (assuming that there was a "X"  to the right of each Property Node, as proposed by Rene):

 

ScreenHunter_002.jpg 

 

vitoi
Active Participant

I think it better to explicitly (and separately) close off references. However, like the idea of the wires lining up.