russelldav wrote:
Sorting the coercion dot sorted all my problems. Thanks altenbach.
I agree with smercurio_fc that the correct solution is the typecast function, but even for the typecast function you need to sort out your coercions.
Let's look at your code:
There are three coercion dots! one on the "byte array to string", one on the "Array" indicator, and one on the "Array 2" indicator.
From this it is clear that the original data coming from the left is NOT I16, but probably a 32 bit representation. All you need to do is ensure that the original wire is actually I16 and everything will fall in place.
Use typecast instead of all that byte gymnastics! 😄 If you use typecast, everything will be correct, no matter what the original representation is, as long as you cast it back to the same type it was originally.