04-07-2011 08:02 AM
Hi,
I'm trying to create a subVI that writes a header text file containing info on essential parameters in my measurements. My mainVI front panel has a few dozen controls, some of them contained in a handful of clusters.
What I'd want is just to be able to access and read the values at the subVI to construct the string I want to write to the file.
I wouldn't like to proceed the dumb way, i.e., building an array of clusters or individual controls or references to them and passing that to my subVI (and, obviously not passing each individual control/cluster as a subVI input).
I figured I'd like to have some kind of refnum of the mainVI frontpanel passed to my subVI and dig use a big pile of property nodes to dig out the info that i need, inside the SubVI. Is this a feasible solution and if so, what's the way to conduct it? If not, what would be a better way?
As before, I'm using LV7 so in case you answer with block diagram examples, I'd appreciate screenshots of them.
Thanks,
Lauri
04-07-2011 11:52 AM
Lauri,
Is this what you're looking for - a reference of all your controls at once to send to a subVI?
Eric
04-07-2011 11:58 AM
Looks promising. I'm already working on methods to dig out stuff from the Controls[] array by giving the name of the Control I want.
What is the magic way to make a reference to "This VI"? Not finding a way to make that kind of reference is, I suppose, the origin of my problem.
Lauri
04-07-2011 12:02 PM
On your functions palette under programming>application control, there is a VI Server Reference. Just place it on your block diagram.
04-07-2011 12:07 PM
I can't seem to find it. Even the search tool in my functions palette returns nothing. Maybe this wasn't introduced yet in LV 7?
Lauri
04-07-2011 12:52 PM
@Vostokki wrote:
I'm trying to create a subVI that writes a header text file containing info on essential parameters in my measurements. My mainVI front panel has a few dozen controls, some of them contained in a handful of clusters.
What I'd want is just to be able to access and read the values at the subVI to construct the string I want to write to the file.
I wouldn't like to proceed the dumb way, i.e., building an array of clusters or individual controls or references to them and passing that to my subVI (and, obviously not passing each individual control/cluster as a subVI input).
Lauri
Actually that is the preferred way to do. Why you may ask? It is because you decouple the functionality (creating your log file header) from your specific user interface. By doing so you can reuse this VI in other places or applications. By using the references directly this ties the subVI to the calling VI. Unless the subVI is specifically doing something to the UI itself a subVI should avoid accessing data it needs via direct references. It should require the data to be wired in with the appropriate clusters, arrays or whatever your data needs are.