Negative Value in formula returns -65335

Good day.
I am having a problem where I am adding 3 numeric fields together, but as soon as one field has a negative valude, my result field, which is a variable string, returns the negative 65335 answer. If all 3 fields have a positive amount in, the answer is correct. I used the devide by 16 in the formula (found on the internet), but it has no effect on the answer.

Any advice and help would be appreciated

Kind regads
Tjaart

this is what it looks like:
image

What are your data types?

Hi. As soon as I read your question, a light went on :wink:
The result field was a CSTRING and not a USHORT like the others.

Thank you very much

Tjaart

1 Like

I recommend changing all the fields to be LONG, not USHORT. The U in USHORT is Unsigned, meaning thd type cannot hold negative numbrrs.

Plus a LONG is faster than a USHORT.