Nintex Form Variable calculating as text rather than number

  • 7 December 2018
  • 1 reply
  • 6 views

I am trying to do a calculation in an Nintex Form Variable, but the calculation is not working as I expect.

 

The calculation that is not working correctly is:

((_intYr%100)+round(((_intYr%100)/4),0))

 

_intYr is another form variable where I am getting the year portion of a date field on the form.  So in this case, the _intYr is calculating to 2018.  I have _intYr saving as data type integer and that works fine.

 

In the above calculation, I am getting an answer of 185.  I feel like I should get 23.  The first part _intYr%100 should calculate to 18 and if I only calculate that portion of it by removing the second half of the equation, I do get 18.

 

The second half should evaluate to 5 and if I remove the first half, it does.

 

The problem seems to be that when I put them together it adds the two halves of the equation as text rather than numbers.

 

It seems to return:

 

18+5 = 185 rather than 18+5 = 23.

 

Any thoughts on why it is calculating that way or how to fix?  The data type for the form variables (_intYr and this one) are both integer.


1 reply

I was able to trick this to work by making the second term negative and subtracting.  Still like to understand how it decides whether to perform text join vs. mathematical add.

This works:

((_intYr%100)-(-round(((_intYr%100)/4),0)))

Reply