From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

From any running subvi('s), read controls and choose the ones you want to save to file

Hi all,

 

I now want to read controls from any running subvi('s) and save the data into a single file. I'm using subpanel to display the running subvi and use control reference to collect all the string-typed control and save the data to a single file. While that's cheating and ugly, because the host vi usually doesn't know what controls will be there in the subvi('s).

 

I'm wondering if there is a way to dynamically read controls from any running subvi and display all the avalible controls depends on what subvi is running, and let the user decide which data are to be saved. I attached the vi I have now, please give any comment and I thank you very much in advanced.

 

-chen

0 Kudos
Message 1 of 9
(2,471 Views)

Hi thitchen,

 

without looking at your code:

with the VI reference you can get references of all controls on the VI's frontpanel. With that reference array you can collect all string controls in that subVI. The you should display a list to the user with the names/contents of those string controls so she/he may select which ones to save...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 9
(2,442 Views)
Thank you. But could you give a hint on how to program to read the user's selection, please? Many thanks.
0 Kudos
Message 3 of 9
(2,436 Views)

Hi thitchen,

 

you could use a list control with "multi selection" enabled. So the use can mark all items that should be saved...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 9
(2,434 Views)
OK, I kind of catch what you mean.

But one more question, please.

Those Subvi 's not only have string typed controls, they may also have INT DBL...
but control reference only return a "variant" which is up to the programmer to decide which specific class data to convert to, do you know a way to display all kinds of controls without knowing the type of each of them? Many thanks.
0 Kudos
Message 5 of 9
(2,430 Views)

Hi thitchen,

 

you can check the control type the same way you can read the label and the value: by property node...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 9
(2,415 Views)
GerdW, thanks so much for your time to answer my questions!
0 Kudos
Message 7 of 9
(2,404 Views)

maybe his example will help you...

0 Kudos
Message 8 of 9
(2,395 Views)

Hi apok,

 

Thank you for the example, not sure whether we are talking about the same problem. Anyway, I'll go with control reference to read out the data from the running subvi's. Thank you for your comment.

 

Best,

-chen

0 Kudos
Message 9 of 9
(2,388 Views)