Error 91 From Variant to Data VI

Updated Jul 1, 2021

Reported In


  • LabVIEW

Issue Details

I'm getting the following error from the Variant to Data VI:



This error can be caused by different reasons. check below the possible causes and solutions:

Converting the variant to an incorrect datatype
If you try to use the Variant to Data VI to extract a data type that is not included in the variant you are inputting, you can get this error. For instance, see the below VI, which is trying to extract a Boolean from a variant. 
While there is a Boolean in the variant, it is actually stored in the cluster, so you need to convert the variant to a cluster and then extract the Boolean from the cluster. The correct way to extract the Boolean from this code is shown below:

Using shared variables to store maps
If the original variant contains a map and you store it on a shared variable, when you pass the shared variable to the Variant to Data VI to try to extract the map from the variant, you will receive this error. This happens because shared variables currently can't store maps. Even though the shared variable can store a variant, at the end, the variant contains the original data, which in this case is a map. To work around this limitation, you can use different data structure (array or cluster) or separate out the keys and values of the map and rebuild the map after passing the data through the shared variables.