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

658
4
Jump to solution
08-21-2019 05:49 AM
KatieWise
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)
0 Kudos
1 Solution

Accepted Solutions
BrittneyGibbons1
Occasional Contributor

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
BrittneyGibbons1
Occasional Contributor

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})).

KatieWise
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.

BrittneyGibbons1
Occasional Contributor

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.

0 Kudos
DougBrowning
MVP Esteemed Contributor

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

0 Kudos