Sharon_ Posted December 23, 2011 Report Share Posted December 23, 2011 (edited) 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.. 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? 3)If it is possible, what are the pros and cons ? Thanks for your time..!!! Regards, Sharon Edited December 23, 2011 by Sharon_ Quote Link to comment
jgcode Posted December 23, 2011 Report Share Posted December 23, 2011 To call a VI dynamically you are going to have to: Know where that VI exists in a hierarchy (on disk or inside and .exe) Open a reference to it using Open VI Reference and the above path 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. Quote Link to comment
vugie Posted December 23, 2011 Report Share Posted December 23, 2011 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. Quote Link to comment
jgcode Posted December 23, 2011 Report Share Posted December 23, 2011 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?). Cheers -JG <edited> 1 Quote Link to comment
Sharon_ Posted December 27, 2011 Author Report Share Posted December 27, 2011 (edited) 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? Thanks for your time..!!! Sharon Edited December 27, 2011 by Sharon_ Quote Link to comment
jgcode Posted December 28, 2011 Report Share Posted December 28, 2011 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)? Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.