LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to access a known control in a VI reference?

Solved!
Go to solution

Hi.

 

I want to open a sub-VI that is one out of many sub-VI's with the same input and output terminals.  But I can't seem to find a way to access any of the terminals directly.  I believe I found part of the solution in this thread (http://forums.ni.com/t5/LabVIEW/How-can-i-get-the-reference-to-Controls-from-VI-reference/m-p/510319...), but I'm sort of stuck right before the finish line, I think. 🙂  Can anyone help me with this?

 

Underneath you can see what I've got so far.  The path will be changed runtime based on config files, but the input and output controls in the VI's will always be the same.  As you can see, I've tried to wire in the type of the VI's to the Open VI Reference block.  I've also attached the sub-VI that indicates which controls and indicators that are used.

 

More specifically, I want to be able to input a number to the Input Buffer control, and to be able to read out any of the indicators in the Test Data cluster (preferably using eg. Unbundle By Name).

 

Thanks a bunch for any assistance!

24390i0BA8A4F2ADEFFE80

0 Kudos
Message 1 of 5
(3,804 Views)
Solution
Accepted by topic author ojohnsen

If all of the SubVIs have the same connector Pane you can use the Call by Reference Node.

 

24396i9109AE5DF474728D

 

 

Visualize the Solution

CLA

LabVIEW, LabVIEW FPGA
Message 2 of 5
(3,784 Views)

You have a variant data. You can convert it to the cluster with the variant to data function. Right-click on the value and select variant palette.

 

Felix

0 Kudos
Message 3 of 5
(3,761 Views)

Spectre David:  Thanks a bunch.  Call By Reference did the trick.  The icons look slightly different though, but I guess that's because of me using a different version of LabVIEW than you, perhaps...?  Even so, here's the solution:

24448iD00CF51C11728858

First a sub VI perpares the file name, and I then check if the file exists.  If it exists, I open a reference to it and then call it sending in the test number and retrieving the test data.  Works like a charm (so far)! 🙂  But I'm wondering...  In this case, I'm opening a reference to the file every time I run a test that uses that specific file.  Is it necessary to do a check if a reference to the file already exists?  And do I also need to close the reference to the file afterwards?  I'm worried that opening and closing the reference to the file every single time I run a test, it will cause a delay in the test procedure.

 

F Schubert:  Thanks for the reply.  I tried the variant approach, but I think I stumbled somewhere on the way.

0 Kudos
Message 4 of 5
(3,753 Views)

I tested with adding Close VI Reference after the test was finished, and it doesn't seem to affect the speed noticably.  So I believe I'll keep it like this:

24458i315A68997A390D3D

0 Kudos
Message 5 of 5
(3,747 Views)