GisPro_calculate fields sqr

1277
4
Jump to solution
09-23-2020 06:06 PM
YoonseoYang
New Contributor II

Hi, everyone. 

I'm using ArcGisPro, try to using 'calculate fields' tool. 

I import following formula, "*.cal" file. 

!P110003! / ((Sqr ( ( !x_coord! - !site1x!)^2 +( !y_coord! - !site1y!)^2 ))/5280)

Following error appears. 

ERROR 000539: Traceback (most recent call last):
File "<expression>", line 1, in <module>
NameError: name 'Sqr' is not defined

*.cal file works well on ArcGis without an error. 

How could I solve this problem?

Please help~! Thanks in advance. 

0 Kudos
1 Solution

Accepted Solutions
DanPatterson
MVP Esteemed Contributor

^ should be **

!P110003! / ((math.sqrt((!x_coord!-!site1x!)**2 + (!y_coord!-!site1y!)**2)) / 5280)

... sort of retired...

View solution in original post

4 Replies
HamedFarzin
Esri Contributor

Hi 윤서 양,

Change "Sqr" to "math.sqrt"  like below and try one more time. 

!P110003! / ((math.sqrt ( ( !x_coord! - !site1x!)^2 +( !y_coord! - !site1y!)^2 ))/5280)

 

Cheers,

Hamed 

YoonseoYang
New Contributor II

Thanks for your comment. 

When I change "sqr" to "math.sqrt" as following.  

!P110003! / ((math.sqrt((!x_coord!-!site1x!)^2+(!y_coord!-!site1y!)^2)) / 5280)

Other error appears as following. 

Please help~! Thanks in advance! 

0 Kudos
DanPatterson
MVP Esteemed Contributor

^ should be **

!P110003! / ((math.sqrt((!x_coord!-!site1x!)**2 + (!y_coord!-!site1y!)**2)) / 5280)

... sort of retired...
YoonseoYang
New Contributor II

It worked!!! Thank you Hamed Farzin and Dan Patterson!  

0 Kudos