I have a system where shared variables are used to write values from an RT system to any number of client consumers (loggers, various UIs).
I would like to be able to dynamically retrieve all of the shared variables and associated typedef clusters in all client programs, so that by adding a shared variable and associated typedef to the library, all clients will be able to handle and use the new data without having to be explicitly updated.
Retrieving all shared variables from a library seems straightforward using the search variable container function, provided the shared variables are kept as variants rather than strictly typed clusters.
I can't figure out how to pull through parameters from my typedef clusters from a shared library however. I can retreive an array of the typedef names, but I can't seem to retrieve anything from within each typedef. Ideally I want to pull out references for each control within each typedef so that I can programatically retrieve cluster specific parameters.
Please see the attached screenshot. Thanks
I have found a way to retrieve the typedef parameters by explicitly addressing their location and using a recursive file list function, rather than using the shared library .lvlib file.
References for each typedef ctl are then opened using the Open VI reference function, which allows the ctl parameters to be extracted using property nodes. This methodology casts the full contents of each .ctl into a single variant though, and I cannot seem to address them as clusters to extract specific parameters like label/caption text more easily.
Is there a simple way to do this? Please see attached screenshot.
I think the main issue you are grappling with is that until the program runs, the references don't actually contain any information about what type of cluster the program needs to expect so it will only show up as a variant type (the default data type).
I think something to explore would be using strictly typed reference described here:
Passing a strictly typed reference will let the program know what to expect before running. Then your property nodes should populate with all the parameters you are expecting.