LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a VI refnum

Solved!
Go to solution

When i use the Dynamically loading and calling VIs. I don't know how to create a VI refnum.

like below. how to make the subVI like that?

AA.jpg

0 Kudos
Message 1 of 11
(8,556 Views)
Solution
Accepted by topic author LabviewKK

Ctrl+Space for Quick Drop... "Static VI Reference"

 

You'll have to choose a VI to drag the connector pane to it to get the visual representation you want.  (Or right-click -> Browse for Path)

 

If you don't want the static reference, you can also just use the "Open VI Reference" with a path to the VI you wish to dynamically load wired in.

Message 2 of 11
(8,521 Views)
Solution
Accepted by topic author LabviewKK

Although not explicitly what you asked for, it's worth noting if you see a star, then the reference is "Strictly Typed". You can right click on the reference and choose "Strictly Typed VI Reference" to toggle this star.

strict.png

I mention this because it's necessary to use the reference with, for example, Call by Reference.

 

Here, the icon references a specific VI. If you want only the pattern, create a constant reference from the Call node and then go to Right Click > Select VI Server Class > Strictly Typed VIs > pick the connector pane.

 

You might need to have already chosen a VI with the same pattern to have it appear... I'm not sure...


GCentral
Message 3 of 11
(8,485 Views)
Solution
Accepted by topic author LabviewKK

Just to be complete, the node you have in your original post is a type specifier VI refnum. It only specifies the "type" of the VI, that is, the connector pane. You can use it to dynamically open a VI reference with the type of connector pane. A static VI reference with type specified can be used for the same purposes (Call By Reference or Start\Wait for Asynchronous Call), but it is not dynamic (but static). Dynamic meaning "opened by name\path".

0 Kudos
Message 4 of 11
(8,469 Views)
Solution
Accepted by topic author LabviewKK

It's also located in "Application Control"

 

static VI ref.JPG

Message 5 of 11
(8,463 Views)

Thank you every one, i found it!

0 Kudos
Message 6 of 11
(8,453 Views)

 

Why when I use this function,  this sub vi did not pop up in front of panel? somewhere wrong?

image.png

0 Kudos
Message 7 of 11
(8,439 Views)

Assuming that the static reference and the type reference match, that looks OK to me. I just checked a very similar setup and it worked for me.

 

If you want the subVI to open the panel when it runs, you'll either need to include VI Server functions to open it, or set the VI Properties (specifically Window Appearance > Customize > Show front panel when called) to open the front panel.

 

Is it possible your VI is working, but that it doesn't have instructions to open the panel?


GCentral
0 Kudos
Message 8 of 11
(8,426 Views)

@cbutcher wrote:

Assuming that the static reference and the type reference match, that looks OK to me. I just checked a very similar setup and it worked for me.

 

If you want the subVI to open the panel when it runs, you'll either need to include VI Server functions to open it, or set the VI Properties (specifically Window Appearance > Customize > Show front panel when called) to open the front panel.

 

Is it possible your VI is working, but that it doesn't have instructions to open the panel?


You need to explicitly open it with a method. The Show Front Panel When Called option does not work (by disign) when called dynamically.

 

Note that you can open the front panel with a method from the VI itself, and\or from the calling VI.

 

Closing it when done also needs to be done "manually" .

0 Kudos
Message 9 of 11
(8,412 Views)

Not to be contrary, but either I'm misunderstanding (certainly possible) or what you're saying is not true.

 

Attached is a 2017 project with two VIs, "Caller.vi" and "Callee.vi" in which the caller uses almost exactly (i.e. without Queue and Case Structure) the same code to call "Callee.vi", which is set to Open when called.

 

Running Caller opens Callee and you can see the inputs correctly passed. Since there is no wait for results, the results are visible but irrelevant to the caller.

 

p.s. as a follow-up, setting execution to shared clones doesn't change this behaviour - a clone of Callee is opened on each run of Caller.


GCentral
0 Kudos
Message 10 of 11
(8,409 Views)