LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to obtain a list (string) of all elements within a Global Variable?

Is it possible to obtain a list (string) of all elements within a Global Variable?
 
I have a Global Variable with many (~100) elements.  I was wondering if it is possible to list all elements and place them into a string array..
 
to avoid lots of Copy / Paste..  or worse.. typing.
 
Thanks,
 
JLV
Message 1 of 47
(4,213 Views)

That's a piece of cake.

The Global is just a VI that has no block diagram.

Open a ref to the VI.

Get a ref to the FP.

Property node to get an array of refs to controls[]

Wire to a For loop and read the Label>>> Text.

You know the rest!

Ben

Message Edited by Ben on 09-27-2006 08:35 AM

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 2 of 47
(4,208 Views)
Thanks Ben!
0 Kudos
Message 3 of 47
(4,200 Views)

I forgot to mention.

All elements within the Global Variable are within Tab Controls..  This is where it got tricky.  I can get the name "Tab Control"..  but it's to get the name of each Tab, then each element within each Tab.. 

not to complicate things, of course!

🙂

Message 4 of 47
(4,189 Views)
That shouldn't be too hard as well:


With some recursion you'll get the idea.

Ton

Message Edited by TonP on 09-27-2006 05:28 PM

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 5 of 47
(4,183 Views)

Thanks Ton..

That's where I went wrong..  The "ClassName" TabControl..!!!!  ARRRRGGGG!!!!HHHH!!!

I'll try it and post the progress..

😄

Message 6 of 47
(4,178 Views)

Another variation on Tons example would monitor the error cluster coming the the "To More Specific" node after attempting to convert to a "Tab Control" type. If it converted OK, the control was a tab control.

BTW: the approach also helps in scripting if you are trying to find an object of a specific type.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 7 of 47
(4,177 Views)
If I'm right there is somewhere in vi.lib a traverse utility. I'm not sure if it could output all the controls with the naming you want but maybe it's something for you.
Found it:
vi.lib\utitily\traverseref.llb

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 8 of 47
(4,172 Views)
Wouldn't "Get All Controls in Container.vi" be wonderful ("Container" could be a front panel, tab control, tab page, cluster, ...).  Has anyone made this that they want to share???
 
Jaegen
Message 9 of 47
(4,166 Views)

Thanks guys!

It worked very well. 

Yes, "Get All Controls in Container.vi" would be wonderful.

RayR

Message 10 of 47
(4,160 Views)