10-30-2009 11:13 AM
Hi guys !
In my application I was using in my subVI a cluster of booleans for the different types of errors I could have.
It wasn't really convenient to manage all these clusters so I decided to create a global one.
Now the problem is that I'm not able anymore to extract the labels and values of this cluster. Before I was passing as a reference theses values but I think there is no way to create a reference directly from my global variable (cluster).
So as you can see in this printscreen I created a new array indicator in my VI. But if I am adding a new boolean value in my global cluster I need to create again the cluster and it is not really convenient.
The goal is to list the errors in a string only if the value is true.
I don't know if I am clear, if not I can explain more.
Solved! Go to Solution.
10-30-2009 12:43 PM
Make your control a typedef and save it. Then drop the typedef into your global variable. If your indicator is also made from that typedef, then all you need to do is update the typedef contro and both the global and the indicator should update automatically. I never use global variables, however, so you'll need to verify this.
11-02-2009 02:28 AM
Hello,
Thanks for your reply, but I'm not sure I undestand it right...
I created a Error.ctl but I cannot drop it to the ErrorList.vi (which is my global variable)...
Can you tell me more.
Or is it another way (trick) to do what I want ?
11-02-2009 02:47 AM
Hi remvu,
you can right-click the control and select "Replace"...
One way to access the global variable should be to open a reference to the owning vi and get all controls via the front panel reference (never tried for a global, but should work too). But anyway: use FGVs instead...
11-02-2009 04:12 AM
I'm sorry but I didn't succeeded to program neither of them...
What control should I transform to typedef and where should I store it ?
I'm completely lost...
Maybe I will be better with a little screenshot or a exemple VI...
Thanks again
11-02-2009 05:30 AM
11-02-2009 05:41 AM
I am not sure if this works (I never did something the like with globals), but you can give it a try:
Use the VI Server to open a reference to your global. Use the FP.Controls[] property and index the error cluster control (so 0 if it is the only control). Wire this reference to your property node.
Felix
11-02-2009 09:18 AM
I tried this way :
But as you can see when I wire the "Clust (strict)" to my reference (which is the control in my global variable), I don't know why but I could have access to this class...I did something wrong ?
Because the reference is for sure the cluster.
Oh my god, I think I would give up to find an automatic way, I can still delete and create again my control each time I do a modification to my global...Because I already lost so much time.
It just sound weird for me to have so much difficulty with LV just to extract the names and values of my booleans in my global variable
11-02-2009 09:23 AM
11-02-2009 09:38 AM
My Nugget on Expoiting Control References should give you all of the hints you need to accomplish what you are trying.
The code included demonstrates how to navigate into a un-known data structure starting with only a reference.
please note that I encouraged using a Type Definition in that Nugget as many of the prvious posters have suggested. I wrote about the power of Type definitions in this Nugget.
Ben