LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Variant data conversion to path

Solved!
Go to solution

Hello all

 

I am trying to use a config file to store my settings data. At the moment this consists of COM port settings and paths. I thought that it would be best to return a variant from my VI, but my code below gives this runtime error:

 

LabVIEW:  The data type of the variant is not compatible with the data type wired to the type input.

 

So this means that Labview doesn't handle the Variant > Path type conversion. I can go back to sending out string data and converting this to a number or path in the calling code, but is there a better way to do this?

 

Thanks for any suggestions (I am a newbie)

 

Ray

 

Variant to Path fail.png

 

 

0 Kudos
Message 1 of 3
(2,442 Views)
Solution
Accepted by topic author Radiator

It should work just fine.  When you get it from your config file, are you reading it as a string?  If so, that is your problem.  The item has to be a path before converting it to the variant.  If your variant is based on a string, you'll have to convert it to a string, then a path.

Message 2 of 3
(2,430 Views)

Thanks Matthew - the problem was as you stated - I was converting String > Variant > Path.

0 Kudos
Message 3 of 3
(2,427 Views)