LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Binding shared variables programmatically

Solved!
Go to solution

I`m trying to programmatically bind shared variables but I can't get it working properly. My goal is to reuse a front panel to work with several groups of shared variables (implementing faceplates in a SCADA solution).

 

Somebody knows what is the right solution to achieve success?.

 

Find attached my last failed attempt, no errors but not working.

 

Some help or examples will be appreciated. Thanks.

0 Kudos
Message 1 of 3
(4,478 Views)

Hi MMCDAT:

 

If you have the DSC module for LabVIEW, the answer is in this link: http://digital.ni.com/public.nsf/allkb/2E8BAD0EA218A7558625712E0003F044?OpenDocument

 

However, if you don't have this module the change is a bit more difficult. As I could read in a document... "You can programmatically change the data binding of global shared variables by opening the library reference and using property nodes. 

  1. Right-click on the block diagram and select Programming » Applciation Control » Invoke Node.
  2. Click on Method and select Library » Open.
  3. Right-click the path terminal and select Create » Control.
  4. Enter the path to the library containing the variable you want to change the binding of.
  5. Right-click the Library.Open terminal and select Create » Method for Library Class » Get All Descendents.
  6. Wire the Library.Open terminal on application invoke node to the reference terminal on the library invoke node.

 

library nodes.jpg

 

  1. Add an index array vi to the block diagram by right-clicking and selecting Programming » Array » Index Array.
  2. Wire the Get All Descendents terminal into the Array terminal on the index array vi.
  3. Right-click the index terminal and select Create » Constant.
  4. Enter the index of the variable you would like to change the binding of.
  5. Right-click the element terminal and select Create » Property for ProjectItem Class » Variable Reference.
  6. Wire the element terminal into the reference terminal on the property node.
  7. Right-click the Variable Reference terminal and select Create » Property for Variable Class » Network » URL.
  8. Wire the Variable Reference terminal to the reference terminal on the variable property node.
  9. Right-click on Network.URL and select Change to Write.
  10. Right-click the Network.URL terminal and select Create » Constant.
  11. Enter the path to the variable to bind to in the format COMPUTER NAME\\Library\Variable

Variable URL.jpg

 

Download All
0 Kudos
Message 2 of 3
(4,456 Views)
Solution
Accepted by topic author MMCDAT

Hi Sendia,

 

Thank you for your quick reply. I have the DSC module, and following indications in the above-mentioned link I have achieved the next results:

 

* If executing the application from LabView, that solution runs but no properly, every time I change a shared variable binding the next error appears (one time), see SV_Binding_Error.PNG

 

* If executing the standalone application compiled (.exe), every time I change a shared variable binding no error appears but there is no change in data binding.

 

Best regards.

0 Kudos
Message 3 of 3
(4,433 Views)