Hello,
I recently ran into an issue where I had to pull data from a Network Published Shared Variable that is an intricate cluster of clusters, types, arrays, etc...We have numerous versions of this code deployed on hundreds of machines where the type definition deployed in the field changed slightly with each version. The issue with NPSV's is that if the type definition on the client side doesn't match exactly with that published by the server, it throws:
Error -1950678965 occurred at Read Variable in #####.vi
Possible reason(s):
LabVIEW: The value read is of a data type that cannot be converted to the data type of this Shared Variable node.
I needed code that will work regardless of the version of the server. It is possible to keep all revisions of the typedef and iterate through them to find one that does not error out, but there is a simpler solution. Fortunately, the top level type is a cluster and I know that I only needed the 7th element of that cluster.
When pulling a NPSV, LabVIEW will allow you to pull it as a variant of any NPSV without error! Then I just needed to decode the variant. I found this article that was very helpful:
So here's the code I ended up using:
This code works for all versions of the deployed code as long as the position of cluster item does not change (it doesn't).
I thought this would be helpful for others, future me, and NI Tech support to show how I solved the problem. Using the VI's in the "Data Type Parsing" palette, same as the "Get Cluster Information.vi", it would be possible to dig through more complex data types if needed.
Enjoy!