LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error 91 - Trying to Use the Variant to Data Function

Solved!
Go to solution

I am running into a problem when trying to use variants in my application. I have a state machine set-up in that one state creates a task list (cluster of arrays) and then converts it to variant. The variant is fed into a shift register that allows me to access the task list from a different state.

 

The problem comes when I try to use the Variant to Data function. I right click on the task cluster to create a constant, and then wire that to the TYPE terminal of the Variant to Data Function. I wire the task cluster variant to the VARIANT terminal. When I run the VI, i get error 91: Possible reason(s): LabVIEW: The data type of the variant is not compatible with the data type wired to the type input.".

 

How can I get this error when the type I wired to the TYPE terminal of the Variant to Data terminal is a constant created from the exact type created a variant from???

 

 

Section of the state machine where I wire the cluster to variant:

Data to Variant.jpg

 

Section of the state machine where I use the Variant to Data to get the cluster out:

Variant to Data.jpg

 

The constant wired to the Variant to Data TYPE terminal was created from the cluster that is wired to the Data to Variant. I do not understand how there can be a type mismatch???

0 Kudos
Message 1 of 7
(13,062 Views)

Is your cluster a typedef? If not, two clusters that are created that look the same may not be the same. For example, if you create two clusters each containing a string, a number and a boolean but create the elements in a different order the two clsuters appear to be the same but are actually different. I recommend that you use typedefs.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 2 of 7
(13,059 Views)
Solution
Accepted by topic author hazmat87

Are there any other state that run between these two?  I am noticing you have some "Use default if unwired" tunnels comming out of your case structure.  First of all, disable that on the tunnels.  Secondly, for those cases where you are not affecting that data, wire the data straight from the input tunnel to the output tunnel.  I recommend using the linked tunnels to make it even easier on yourself.

 

With the default tunnels being output, your variant coming in could really be empty, therefore the conversion fails.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 7
(13,055 Views)

I see you have set the variant tunnel on the right side of the case structure to "Use default if unwired". This can bite you in the... Make sure it is wired across in ALL states, otherwise what is happening is you are calling some state in between that is not wired and the default value for the variant is an empty variant. I HIGHLY recommend right-clicking those terminals and unchecking "Use default if unwired" unless you absolutely need it. It's much better to see errors at design time than at run-time.

Charles Chickering
Architecture is art with rules.

...and the rules are more like guidelines
Message 4 of 7
(13,049 Views)

@crossrulz wrote:

Are there any other state that run between these two?  I am noticing you have some "Use default if unwired" tunnels comming out of your case structure.  First of all, disable that on the tunnels.  Secondly, for those cases where you are not affecting that data, wire the data straight from the input tunnel to the output tunnel.  I recommend using the linked tunnels to make it even easier on yourself.

 

With the default tunnels being output, your variant coming in could really be empty, therefore the conversion fails.


Are you stalking me today? Smiley Happy Every single post I've clicked comment on, you beat me by a hair!

Charles Chickering
Architecture is art with rules.

...and the rules are more like guidelines
0 Kudos
Message 5 of 7
(13,046 Views)

@Charles_CLA wrote:

@crossrulz wrote:

Are there any other state that run between these two?  I am noticing you have some "Use default if unwired" tunnels comming out of your case structure.  First of all, disable that on the tunnels.  Secondly, for those cases where you are not affecting that data, wire the data straight from the input tunnel to the output tunnel.  I recommend using the linked tunnels to make it even easier on yourself.

 

With the default tunnels being output, your variant coming in could really be empty, therefore the conversion fails.


Are you stalking me today? Smiley Happy Every single post I've clicked comment on, you beat me by a hair!


No, just 12 hour days (due to the holiday) get really long...and you are just slow.Smiley Tongue

 


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 7
(13,043 Views)

Good catch on using the "Use Default if Unwired" on the tunnels of the case structure Smiley Happy

 

I wired data straight from the input to the output tunnel in cases where it is not used. This fixed the issue and everything is running smoothly now.

0 Kudos
Message 7 of 7
(13,019 Views)