Hello!
I have a lot of data and want to show just every 100th data( 0, 100, 200, 300, 400 and so on till 43000) in a map. I dont want to use the Query Builder in this way: "KP_CABLE" =0 OR "KP_CABLE" =100 OR "KP_CABLE"=200..... Has anyone an good idea?
Furthermore: How can I show in my map the name to the symbology for each 100th point? For example I want to show in my map the points 0, 100, 200,... with ne name on it: KP0, KP100, KP200?
Best wishes!
Add a new field and calculate values to use for labeling and symbology.
It will return the field value if the modulus is 0, otherwise 0.
def modu(fld, divby):
"""return the modulous and vals"""
if (fld % divby) == 0:
val = fld
else:
val = 0
return val
# ---- expression
#------ modu(!YourField!, 100)
for i in range(10): print(modu(i,3))
0
0
0
3
0
0
6
0
0
9
Hello,
thnaks for your answer. I never used a Field Calculator with expressions like yours.
# ---- expression
What is the meaning of that? Do I have to change here something?
def modu(fld, divby):
"""return the modulous and vals"""
if (fld % divby) == 0:
val = fld
else:
val = 0
return val
# ---- expression
#------ modu(!YourField!, 100)
Using this, it leads to an error.
Sry, I really dont get it. I tried to copy and paste this into the Field Calculator
def modu(fld, divby):
"""return the modulous and vals"""
if (fld % divby) == 0:
val = fld
else:
val = 0
return val
# ---- expression
#------ modu(!YourField!, 100)
But I dont know how to work with this.
Best Wishes
Calculate Field Python examples—Data Management toolbox | ArcGIS Desktop
there is a code block section where you put all the lines of the function (aka, the def)
there is an expression line... that is where you would put the expression .. modu(blah, blah) minus the #--- stuff
I don't have screen grab capabilities, but I am sure you can figure it out
Thanks!
It is probably easier to just use a definition query like:
mod( KP_CABLE, 100) = 0