Jump to content

Dynamic VI Calling


Sharon_

Recommended Posts

Hi friends,

I want to call 'n' VIs dynamically in a loop. I am wondering if we can call the VIs without giving the VI path information?

For instance in the picture shown below..

post-16569-0-45469100-1324623167.jpg

1)Is there a way to pass information of the VIs to the Call by Reference Node without using Open VI reference?

I dont want to use Open VI reference 'coz it is asking for VI's path details?

2)Is it possible to pass the ref value from a "VI" containing all the VI as shown below? :thumbup1:

post-16569-0-54908100-1324623142_thumb.j

3)If it is possible, what are the pros and cons ? :rolleyes:

Thanks for your time..!!! :D

Regards,

Sharon :worshippy:

Edited by Sharon_
Link to comment

To call a VI dynamically you are going to have to:

  1. Know where that VI exists in a hierarchy (on disk or inside and .exe)
  2. Open a reference to it using Open VI Reference and the above path
  3. At some point, load the VI and run it

Maybe it would be best discussing what you are trying to accomplish with your request?

There may be another way.

Link to comment

You may also use "Static VI Reference" from Application Control palette. Put it on the diagram, right-click, select Browse for Path, and select VI. Then you can run it with Call by Reference Node and path for this VI doesn't exist explicitly on BD (however it is stored inside "static" node). If you use dynamic calls in such a way, VI is always automatically included into built application. If you break such VI, broken arrow appears also in VI with static reference.

If you want to run it multiple times, it must be reentrant.

Link to comment

You may also use "Static VI Reference" from Application Control palette. Put it on the diagram, right-click, select Browse for Path, and select VI. Then you can run it with Call by Reference Node and path for this VI doesn't exist explicitly on BD (however it is stored inside "static" node). If you use dynamic calls in such a way, VI is always automatically included into built application. If you break such VI, broken arrow appears also in VI with static reference.

If you want to run it multiple times, it must be reentrant.

My post above was relating to dynamic in the sense of lazy loading.

The Static VI Reference approach will load the VI into memory when the called VI is loaded.

So it really depends on what the OP is trying to achieve.

Using the CBR and specifying a path with an appropriate setting may work?

I have not used this method myself.

I checked and the VI Hierarchy Window shows the called VI when the caller VI is only open (I would have thought it wouldn't?).

post-10325-0-59545200-1324630667_thumb.p

Cheers

-JG

<edited>

  • Like 1
Link to comment

HI jgcode,

I tried running the open VI ref with only the VI names placing inside the main VI folder- there is no problem in execution.

But assuming if 1)I have a statemechine with 5 states and I place 5 subVIs inside every case to execute it

2)If I use dynamic VI calling to implement the same structure using dynamic VI calling - will there be any advantage in terms of memory usage if I use only the VI name for Open VI ref?

I want to ask this 'coz while creating application.exe I had to include all the VIs to execute the Main VI? :oops:

Thanks for your time..!!!

Sharon :worshippy:

Edited by Sharon_
Link to comment
I tried running the open VI ref with only the VI names placing inside the main VI folder- there is no problem in execution.... ...will there be any advantage in terms of memory usage if I use only the VI name for Open VI ref?

Sorry I do not follow 100% - do you mean you are wiring in the VI Name as a String or Path (as you have mentioned folder hierarchy and we are talking dynamic)?

post-10325-0-40720900-1325049159.png

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.