LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading main VI front panel in SubVI

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

0 Kudos
Message 1 of 6
(3,227 Views)

Lauri,

Is this what you're looking for - a reference of all your controls at once to send to a subVI?

 

Eric

 

controls-ref.png

0 Kudos
Message 2 of 6
(3,211 Views)

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

0 Kudos
Message 3 of 6
(3,208 Views)

On your functions palette under programming>application control, there is a VI Server Reference. Just place it on your block diagram.

0 Kudos
Message 4 of 6
(3,205 Views)

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

0 Kudos
Message 5 of 6
(3,201 Views)

 


@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.

 



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 6 of 6
(3,195 Views)