LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read text in variant input terminal on control pane

The problem you are going to run into is that LabVIEW is a strictly typed language, and if you are going to accept any data type (which a variant will) then that means you need an infinite number of cases to convert from your variant to what ever it is you got as an input.  Well I guess it doesn't have to be infinite you can support the dozen or so native types, ignore classes and references, and then implement recursion to be able to go inside containers like arrays and clusters, but still not pretty.

 

What is better is to make polymorphic VIs for each type you will allow.  Then that polymorphic VI will select the appropriate one based on the data type wired.  Look at the Write To Spreadsheet File.  If you wire a 1D array of string to the terminal that is a 1D array of double, it accepts it.  Polymorphic VIs usually work well if you have a relativly small number of VIs to make and maintain.  If you want to accept 60 different data types, you're going to have a bad time.

 

But still there are tons of XML libraries and you may want to look into those first to see if they meet your needs.  Or maybe take one of them that is open source and modify it if you don't like how it handles arrays.

0 Kudos
Message 11 of 11
(626 Views)