Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
For questions about ArcGIS Python Parser for labelling expressions and field calculations
0
votes
Using If Statements in ArcMap Field Calculator
Esri Support provide an How To: Use IF statements in the Field Calculator:
Summary
The Field Calculator uses IF statements to calculate new values in the
field of an attribute table. This article des …
2
votes
Assigning values to field using if/then logic involving multiple fields
Make sure that you have set your parser to Python (as suggested by @Arabella) and then try something more like this untested code:
Pre-Logic Script Code:
def selectter(Majr_src,Top_pct,Top_src,Close_s …
5
votes
Accepted
Using Calculate Field tool to calculate on null fields using ArcMap
This should do it, and also deals with any empty or space-filled strings.
Parser: Python
Pre-Logic Script Code:
def FixNull(Field1,Field2):
if Field1 is None or Field1.strip() == "":
return Fiel …
2
votes
ArcPy expression syntax in CalculateField_management
To do this I would use two Python string methods (format and zfill).
I find workflows like this much easier when approached using arcpy.da.UpdateCursor() rather than the CalculateField_management() fu …
3
votes
Converting full road names to abbreviation using ArcGIS field calculator?
If you only want to use the abbreviations for labelling then you could investigate Using an abbreviation dictionary and the About abbreviating and truncating words page:
Abbreviation dictionaries …
0
votes
Accepted
Converting Angles in a File Geodatabase Table - via Field Calculator's Python
This statement:
def Calculate(NearAngle):
creates a variable named NearAngle but this code:
if ( [NEAR_ANGLE] < 0 and [NEAR_ANGLE] > -180):
[NEAR_ANGLE] = [NEAR_ANGLE] +360
return [NEAR_ …
1
vote
ArcGIS Field Calculator for changeable 3 fields add from table parameter at model builder an...
There is no ArcPy function named GetParameterAsFloat.
You will need to use arcpy.GetParameterAsText() (or possibly arcpy.GetParameter()).
Using print() statements to show what values have been passe …
3
votes
ArcMap Field Calculator Python string concatenation malfunction
Your Python code seems valid because when I run:
def AutoSchluessel(gmk, zae, nen):
return "{}0{}{}".format(gmk, str(zae).rjust(7,"0"), str(nen).rjust(5,"0"))
gmk = 5902
zae = 32
nen = 17
fl …
11
votes
Accepted
Changing default parser in ArcGIS Field Calculator to Python?
I do not think you will find a way to do this because there is an existing, not yet Under Consideration, ArcGIS Idea to have the 'Field Calculator default to Python'.
2
votes
1
answer
9k
views
Converting values in datetime field to strings in text field using Python parser of ArcGIS f...
In the attribute table of my file geodatabase feature class I have a populated field called DateField of type date, and a text field called TextField.
I have not yet hit on a way to convert the dat …
0
votes
Accepted
Python parser of ArcGIS Field calculator returns ERROR 000539: Error running expression?
On a question such as this, where you have described what appears to be a reproducible bug, and has been verified by another member of our community, I think the best way forward is to log it with Esr …
3
votes
Using ArcPy to multiply fields in attribute table?
I think the easiest way to learn "how to use ArcPy to run a field calculation" is to:
Go to the Search window and find the Calculate Field tool
Open its tool dialog
Configure a test calculation and …
1
vote
Extract characters from an existing string field to create a new field
As commented by @FelixIP this can be done in:
VB syntax mid(field,16,3)
and as commented by @faith_dur:
it is much nicer and versatile in Python, i.e. field [16:19]
1
vote
Accepted
Field calculation based on the field name by using arcpy
You seem to know how to do this in the ArcGIS Field Calculator.
Instead, do exactly the same thing using the Calculate Field tool, taking care to set your parser to Python.
Once you have run the too …
1
vote
ArcGIS Python Field Calculation says failure during processing?
I think the cause of this, and the reason you are also having trouble formatting this correctly in the question, is that there is a colon missing after else.
Try this:
def reclass(a):
if (a <= 5 …