LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programmatically redirect shared variables

I can programmatically change the data binding for a shared variable from (from on RT target to another) using method 1 as described here:

 

http://digital.ni.com/public.nsf/allkb/2E8BAD0EA218A7558625712E0003F044

 

However the change is only associated locally with the current VI, if I restart the VI or access the shared variable from a different VI it returns to the initial data binding as defined in the variable library.  I have to change the binding each time a start a VI.

 

Is there a way to programmatically change the data binding in such a way that the change is persistent and shared between vi's?

0 Kudos
Message 1 of 3
(2,597 Views)

Hi PESobol,

 

when you want to store changes you actually need to store them! 😉

 

You can access shared variables programmatically using functions like "Open Variable connection". So you could load a text file with descriptions of your shared variables and connect to such a variable based on information of the text file. For me that seems like a better way of configuration than having to change and save VIs all the time…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 3
(2,594 Views)

Yes, replacing the shared variable nodes with programmatic access at each point is obviously another way to approach a solution, however the NI provided ability to progammatically change the data binding appears to be intended to address this issue without that.  The fact that this solution doesn't share across VI's seems to limit the usefullness.  

I'm updating a large project that was never initially intended to interact with multiple targets, so changing the data binding is a more straightforward solution than changing every shared variable node in the project.  

 

0 Kudos
Message 3 of 3
(2,584 Views)