12-08-2010 04:13 PM
I am trying to create a setup for open shared variable connections using the Programmatic API. It seems to me like the cleanest way to do this would be to put one "open and verify" routine in a FOR loop, then call it for each variable in the library.
The issue I am running into is I have diffrent data types in my library (using a Modbus IO server, and have "boolean" and "single" data types in my library. How can I dynamically select the data type for the shared variable API?
see the attached snipit.
Thanks
Solved! Go to Solution.
12-08-2010 04:44 PM
The data type is defind at compile time and you can't mix them like you are planning.
Unless you set up your shared variable to type Variant, but you will have to convert them back the correct data type on the read end.
12-13-2010 12:20 PM
What I ended up doing was making a subVI to Open, Read, Write, and Close each data type I am using, the packaged them into 4 Polymorphic SubVIs (Polymorphic Open, Poly Read, etc....)
Now all I have to do I drop in the Polymorphic SubVI and it automatically switches to the appropriate data type
09-06-2012 12:30 PM
I am in the process of doing something similiar, however I first am getting the Data Type for each variable in the library. But this value is a variant. How can I convert this to the data type that is required for the open variable connection? Do the subvi's that you created do this? If not, can you show me the vi's you made, I could change my approach to the same as yours.
Terry