LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

get variant attribute

I m using LV 6.0.2, the function "get variant attribute" does not work. I
get nothing out of it: no error, no values.
Any idea?!

Actually I could need exactly the string that is shown in a variant
indicator/control.

e.g.:

'Cluster': cluster of 2 elements
'Array': 1-D array of
'Numeric': double
'Boolean': boolean

'Array' -> (2.000E+0, 2.000E+0)
'Boolean' -> FALSE


Has anybody an idea how I can get this as a string?
Thank You.

Max


--
-> max.weiss@web.de / max.weiss@gmx.de <-
-> Max Weiß * Eulenweg 2 * 76356 Weingarten * Germany <-
-> Fax/Voicebox: 0180 505254775181 * Tel: +49 162 9114507 <-
-> ICQ: 123429315 * DB 8 MWE <-
0 Kudos
Message 1 of 4
(3,464 Views)
Max,

To get a Variant attribute, you must first set one. These were designed to send more than one data element over DataSocket (so a string will be the main data item and a boolean will be an attribute). See the DataSocket with Properties examples that ship with LabVIEW 6.

Randy Hoskin
Applications Engineer
National Instruments
http://www.ni.com/ask
0 Kudos
Message 2 of 4
(3,464 Views)
The reason you can't get an attrivute of the vairant is because your variant doesn't have any. Use "Set Variant Attribute" to add an attribute to your variant, and then you should be able to read it back later using the "Get Variant Attribute".

cheers,
Christopher




Copyright © 2004-2024 Christopher G. Relf. Some Rights Reserved. This posting is licensed under a Creative Commons Attribution 4.0 License.
Message 3 of 4
(3,464 Views)
Shouldn't the function "To vairant" set these attributes automatically from the names of the variables?
 
When I make an array called "Wavelength" and include tha values 0,1,2 in the array and use "to variant", the result is:
 
'Wavelength' -> [3]
(0, 1, 2)
 
When I use "set attribute", name it "Wavelenth" and put in an array with values 0,1,2 I gat
1 Attribute(s):
   'Wavelength' -> [3]
(0, 1, 2)
Not a whole lot of difference, if you ask me. The "to variant" function should do this automatically and save programmers a lot of trouble.
 
Daniel Nilsen Wright
0 Kudos
Message 4 of 4
(3,073 Views)