Type casting from a number to an enum will use only the first (highest) n bytes that it needs to do the representation. In most cases I would argue this is contrary to what most people would expect to occur. To remedy this case, a casting needs to be done on the numeric input before hand so that for example, the number 1 goes to the enumerated value with a number 1.
My suggestion is to have a vi that is specifically designed for typecasting to an enumerated value. This vi would be free to cast the numeric input, so as to match the enumerated input. It could also take in an input string, and try to match the string to the strings values of the enumerated type. I could implement this myself, and might, however it seemed like it might be useful to have that in the same panel as the typecast so that one would be more inclined to use it than the typecast, for enumerated values, and subsequently avoid the problems that come with this unexpected behavior.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Any idea that has received less than 3 kudos within 3 years after posting will be automatically declined.