max calculate on 4 integer fields not returning the actual max integer

86
4
Jump to solution
08-21-2019 05:49 AM
Highlighted
New Contributor II

I created an integer field with a calculation to display the highest number from 4 other integer fields.  So for field ${highest_number}, the calculation is max(${field1}, ${field2}, ${field3}, ${field4}).  Using these numbers as an example: 450, 290, 875, and 1285; 875 is returned as the max number because I assume it starts with the highest number but obviously 1285 is the highest number.  Any ideas on what is going on?

Tags (2)
Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
New Contributor III

It seems to be parsing fields 1 - 4 as text instead of numbers. I would try forcing them to be read as integers using int(): max(int(${field1}), int(${field2}), int(${field3}), int(${field4})).

View solution in original post

4 Replies
Highlighted
New Contributor III

It seems to be parsing fields 1 - 4 as text instead of numbers. I would try forcing them to be read as integers using int(): max(int(${field1}), int(${field2}), int(${field3}), int(${field4})).

View solution in original post

Highlighted
New Contributor II

That did it!  Thank you so much.  I assumed it had something to do with that but wasn't sure the fix.

Highlighted
New Contributor III

Glad that worked! That happens to me all the time. Some fields that I expect to be numerical are processed as text instead, especially if I am using a select one with numerical values.

Reply
0 Kudos
Highlighted
Frequent Contributor II

You can also use the bind::type column set to int on the fields you want to check.  

Reply
0 Kudos