Calculate field model

607
7
Jump to solution
08-22-2017 06:31 AM
EvelynHernandez
Occasional Contributor III

Hello,

Im pretty new on using arcmap and specially using the modelViewer.

Im trying to do the following:

I have 2 layers, point and polygon, that i used a spatial join to know how many points are intersected in the polygon layer.

After i generate the result in a join_count field, i want to add in the percentaje field, the % related to the total of points that i have.

My model is the following.: campamentos is my polygon layer and sed_006 is my point layer.

After executing the model, the percentaje field is still 0.

My formula for calculate field is ([Join_Count]*100)/Filas.

What am i doing wrong?

Thanks for all the help provided!

0 Kudos
1 Solution

Accepted Solutions
JayantaPoddar
MVP Esteemed Contributor

I used the following workflow

Summary Statistics: SUM

Get Field Value:

The expression in my Calculate Field Tool looks like this

([Join_Count]*100)/%Value%

Result:



Think Location

View solution in original post

7 Replies
DanPatterson_Retired
MVP Emeritus

just a guess but that looks like vb syntax.  and assuming it is a field, you might want to try python syntax 

!join_count!*100.0/filas 

Now if it isn't the python vs vb thing, then you should always promote one of the variables to ensure that the math is done as floating point math that is why I put 100.0 instead of 100, since the latter is an integer

0 Kudos
EvelynHernandez
Occasional Contributor III

You mean this? (It didnt work tho)

0 Kudos
DanPatterson_Retired
MVP Emeritus

So is Join_count a field to begin with? and it looks like you are using one of those iterators.  

At this stage, it would be best to run through that calculation manually in arctoolbox, then get the correct syntax from the Results window and use it.  Alternately, if you typed that expression in... don't, use the little calculator to the right of the expression line and select what you can from there typing as little as possible

Finally... doing it manually will at least confirm whether there was any count other than 0 which may be a valid observation

0 Kudos
EvelynHernandez
Occasional Contributor III

I dont understand what i need to do.

But I have the following:

In the camp_spatialJoin as a result (the green circle) i have this info:

Where i have the field percentaje in 0 and for that row, the join_count in 1.

So how to set up the model to have my final result with the percentaje of join:count*100 / qtty of points in sed_006 resource.

0 Kudos
JayantaPoddar
MVP Esteemed Contributor

I used the following workflow

Summary Statistics: SUM

Get Field Value:

The expression in my Calculate Field Tool looks like this

([Join_Count]*100)/%Value%

Result:



Think Location
JayantaPoddar
MVP Esteemed Contributor

You can see Get Field Value tool here.



Think Location
0 Kudos
EvelynHernandez
Occasional Contributor III

Im going to try that  thanks!

0 Kudos