LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
Daniel-E

Compound Close References

Status: New

When using extensive numbers of property and invoke nodes (for example, using the TestStand API) it's very common to end up with many references that need to be closed. This leads to structures like this:

 

closeref.PNG

 

It would be very convenient if we had a Compound Close References node that we could wire multiple references into. Since order often matters with closing references, the node could execute top-down once all references are available at the inputs. This would substantially clean up block diagrams and make API code a bit easier to follow. For example, the above code could just be replaced with:

 

compoundref.PNG

 

13 Comments
D-Cubed
NI Employee (retired)

Perhaps it could have an icon like this:

TSAPIMutipleRefClose.PNG

Daniel Dorroh
National Instruments
crossrulz
Knight of NI

Just make sure you still have the Error In and Error Out.

This idea would also take care of this idea: http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Reduce-the-size-of-the-Close-Reference-VI/idi-p/155858...


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
Daniel-E
NI Employee (retired)

Agreed crossrulz, it would need an Error In and Error Out both for data flow and for any errors that could result from closing the references.

CMal
Active Participant

This may not be exactly what you're looking for, but rememeber that Close Reference can accept an array of references.

close ref.png

PaulG.
Active Participant

Would we not want this to close references from the bottom-up (lower-level to higher-level) in order to retain proper closing sequence? I rarely close refs by array since the closing sequence matters. Or does it? If I remember correctlly closing a higher-level reference before a lower-level wil cause an error message.

PaulG.

LabVIEW versions 5.0 - 2023

“All programmers are optimists”
― Frederick P. Brooks Jr.
Intaris
Proven Zealot

Reverse order would seem to be my taking on it also.  When do we ever need a different scheme for closing references?

 

The Icon for the primitive would perhaps need a qualifier (right-click) to set the direction coupled with an arrow visible at all times (because I really hate hidden settings).

ouadji
Trusted Enthusiast

@ CMal :

 

"...rememeber that Close Reference can accept an array of references."

 

yes, but not in all cases.

 

SR1.png

Darren
Proven Zealot

Am I being a troublemaker if I point out that closing the Panel reference in the previous screenshot is completely unnecessary? 😉

ouadji
Trusted Enthusiast

@Darren :


Could you explain to me why closing the Panel reference is unnecessary?
in advance, thank you very much Darren.

 

(Are there other references which don't need to be closed?)

Darren
Proven Zealot

This document gives a pretty good summary of all the use cases surrounding closing references in LabVIEW:

 

Closing References in LabVIEW

 

When this document was originally released, I lobbied for stronger wording regarding the closing of GObject references (panels, diagrams, and anything that lives on them)...mainly, that it's not necessary. The code below runs without error and returns the MasterRect property at both calls, despite the panel reference being closed prior to the second call:

 

readafterclose.png

 

 

This is because closing a GObject reference is a no-op...LabVIEW will clean up all open GObject references to objects in a VI whenever the VI reference is closed.