Select to view content in your preferred language

how to do math on string fields

1970
7
Jump to solution
06-11-2020 09:00 AM
Matt-Barrett
Regular Contributor

I have a drain pipe layer that includes fields for upstream elevation, downstream elevation, and length.  I want to calculate the slope.  However, the fields are all string fields.  Is there a way to do this in ArcGIS Pro without adding or otherwise changing the fields?  I remember in the old days with avenue you could use a thing like {field}.asnumber or {field}.asstring to a calculate function to do stuff like this, but I don't know if there's a way to do it in Pro.  Thanks!

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
Robert_LeClair
Esri Notable Contributor

Related you could use the field calculator with Python and the float() function then.

View solution in original post

7 Replies
JoeBorgione
MVP Emeritus

Use the field calulator with python and the int() function.

That should just about do it....
Matt-Barrett
Regular Contributor

Thank you.

But would that round up my decimals?  

0 Kudos
Robert_LeClair
Esri Notable Contributor

Related you could use the field calculator with Python and the float() function then.

Matt-Barrett
Regular Contributor

that sounds perfect!  Thanks!

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Please mark one of the replies as correct to close out the question once you get it working.

0 Kudos
Matt-Barrett
Regular Contributor

So I used the float function.  It mostly worked.  Ended up with values in scientific notation.  Got it worked out in the end though, so thank you to those who replied.

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Matthew, I unmarked your reply and marked Robert's as the answer since your comment saying thanks isn't really the answer to your own question.