Certification

cancel
Showing results for 
Search instead for 
Did you mean: 

Closing VI Server References?

Hey guys,

 

Taking my CLD exam a week from today at NI Week, was wondering for maximum points two things:

1) What's best way to initialize FP Objects, doing action on cluster of controls and then writing to Local Variable of cluster or create VI Server References to each object and performing property node stuff to them? I have been building an array of all controls (for ATM examle) and passing that array to a batch enable/disable property node in a for loop. 

2) If I do have VI server reference for any property node, explicity or implicity linked, should I close the reference or will they not care because LV compiler does it for me? **side note: am I right in that statement, does the LV compiler close BOTH implicit and explicitly linked property node references?

CLD | CTD
0 Kudos
Message 1 of 3
(3,548 Views)

@ChrisK88 wrote:

am I right in that statement, does the LV compiler close BOTH implicit and explicitly linked property node references?


I wouldn't say you are right that LabVIEW closes them, I would say that trying to close them will be considred a NoOp because LabVIEW can't close them.  Lets say you have a reference to a control in a VI that is running and you try to close the control reference.  LabVIEW can't really close it because it is open, and being used in that VI so LabVIEW will just ignore the request to close.

 

Now if you opened a new reference to an object, you do need to close it when you are done.  Creating an control reference (implicit or explicit) is not opening a new reference, it is returning the "This Control" reference, which doesn't change with each new copy.

 

https://lavag.org/topic/12181-close-a-passed-reference-in-a-subvi/

 

I think my CLD had all explicit references, and so none could be closed, I'd say you don't need to bother with closing them.

Message 2 of 3
(3,536 Views)

Hooovahh wrote:

 

Now if you opened a new reference to an object, you do need to close it when you are done.  Creating an control reference (implicit or explicit) is not opening a new reference, it is returning the "This Control" reference, which doesn't change with each new copy.

 


I think this just helped me wrap my mind around the confusion. Well said. Thanks!

 

I know on many CLAD exams they had a question regarding "What's the best way to change ... of a control" and the answer was an implicitly linked property node NOT an explicitly linked property node. I never truly understood why that was the correct answer, but taking that into consideration, and from you said about your CLD, do you think it matters how I call the node as long as I use the error lines to enforce data flow?

CLD | CTD
0 Kudos
Message 3 of 3
(3,524 Views)