viSci Posted March 27, 2007 Report Share Posted March 27, 2007 I just noticed that you can use the Scan from String vi to cast a string to an Enum. The vi will automatically adapt to the enum data type when the output is connected to a enum control. If connecting to a vi input that is an enum, you will need to have a local enum indicator to coerse the data type. Please excuse the post if this was obvious to everyone already. Quote Link to comment
Eugen Graf Posted March 27, 2007 Report Share Posted March 27, 2007 Yes, and you can convert enum to string with Format Into String VI too. Eugen Quote Link to comment
LAVA 1.0 Content Posted March 28, 2007 Report Share Posted March 28, 2007 Flatten to and Unflatten From String also work nicely with enums... For example, sending messages between systems or processes. http://forums.lavag.org/index.php?act=attach&type=post&id=5313 Quote Link to comment
ned Posted March 28, 2007 Report Share Posted March 28, 2007 QUOTE(LV Punk @ Mar 27 2007, 06:53 AM) Flatten to and Unflatten From String also work nicely with enums... For example, sending messages between systems or processes. http://forums.lavag.org/index.php?act=attach&type=post&id=5313''>http://forums.lavag.org/index.php?act=attach&type=post&id=5313'>http://forums.lavag.org/index.php?act=attach&type=post&id=5313 The "Flatten to String" is irrelevant here, because the type information (the names of the enumeration items) is available on the receiving side when you unflatten, through the enumeration constant. In fact, the type information isn't even included in the string. Put a probe on the output from "Flatten to String" and you'll see this; if you're not convinced, convert the enumeration to a U16 and note that you get the same result. Quote Link to comment
LAVA 1.0 Content Posted March 28, 2007 Report Share Posted March 28, 2007 QUOTE(ned @ Mar 27 2007, 08:53 AM) The "Flatten to String" is irrelevant here, Flatten to string is required to transfer the data via TCP Write and TCP Read. If you're not convinced, wire any enum to TCP Write and note that you will get a broken wire . I was simply expanding on sachsm's happy observation that enums can be easily manipulated with string functions. Its more efficient and deterministic transmission wise to flatten the enum to a string than to format as a string and send 'broccoli' when 0x0002 can be used... Quote Link to comment
ned Posted March 28, 2007 Report Share Posted March 28, 2007 QUOTE(LV Punk @ Mar 27 2007, 01:04 PM) Flatten to string is required to transfer the data via TCP Write and TCP Read. If you're not convinced, wire any enum to TCP Write and note that you will get a broken wire .I was simply expanding on sachsm's happy observation that enums can be easily manipulated with string functions. Its more efficient and deterministic transmission wise to flatten the enum to a string than to format as a string and send 'broccoli' when 0x0002 (2 bytes) can be used... Ah, my misunderstanding of what you were trying to say. I always think of enumerations fundamentally as numbers, not as strings, even though I regularly take advantage of the ease of converting between them, and I thought you were trying to say that there was some difference between flattening an enumeration to a string versus flattening its numerical equivalent. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.