Field calculators (which are available in QGIS, ArcGIS-related products, etc.) can recalculate the values of a single field, on all, or selected records within a table based on a symbolic expression.

learn more… | top users | synonyms

2
votes
1answer
177 views

ESRI File Geodatabase with a field calculator with an incrementing number

I've got a python script that runs on the Field Calculator of a ESRI File Database. Right now it runs correctly in that it will increment the last three digits of the value. But this is a script ...
2
votes
1answer
258 views

How to return absolute values using ArcMap field calculator?

I have a field of number ranging from -50 to 50. Is there a way using the ArcMap field calculator to populate a field with all of these standardised (positive numbers) so I have a range of 0 to 50 ...
2
votes
4answers
144 views

Field calculator Python else statement question

The codeblock below is run on Field1 and calculates Field1 to equal Field2 if they are not equal. Else it returns Field1. My question is, does the else statement actually recalculate Field1 to equal ...
2
votes
3answers
802 views

Python and CalculateField

I am having trouble with using Python together with my gp.Calculatefield tool in my python script, and I am not sure why.. Heres the code (UPDATED) import arcgisscripting, os, sys myTempWorkspace = ...
2
votes
2answers
492 views

Looking for python/VB script to insert a new uniqe field

Is there any phyton/VB script which will add a field to shapefile which will be corresponding to first three characters from the shapefile name ? I am working in modelbuilder and arcgis 10. Thanks ...
2
votes
1answer
2k views

How to set the value of a field in all selected rows of a table using ArcGIS 10

I have an attribute table in ArcGIS (it's large - around 300,000 elements). I've selected some rows of the table using 'Select by attributes' and I want to set the value of a field for all of those ...
2
votes
1answer
155 views

Python Syntax Error when running Python Snippet of successful geoprocess

I am having an issue with a simple python snippet. Here's the background: I wanted to include an additional step in a nightly update script that replaces characters in a field that simply do not play ...
2
votes
1answer
160 views

How to get the First and Last Point coordinates of a Polyline with Field Calculator in ArcGIS10

I'm trying to get the First Point coordinates (x,y) and Final Point coordinates (x2,y2) from a polyline in ArcGIS 10 with the Field calculator. I've added 4 (double) fields like StartX,StartY,EndX ...
2
votes
2answers
125 views

Comparing 2 fields using Python

I am trying to compare 2 fields(double) using python. I want to round to the nearest 10th and flag those with a "1" that are not equal. Here is what I have at the moment: def Qcontrol(old, new): ...
2
votes
1answer
132 views

Field Calculator: return two or more field value

I trying to return three field values in same If Statment and conecate them, but i Get NULL value insted of the conecated fields getClass (!InDiameter! , !OutDiameter! , !TheridDiameter!, ...
2
votes
1answer
55 views

How can I change all the entries in a field to be entirely lower case?

I have a field with a bunch of species names, but for a single species there a bunch of case combinations (e.g. Cat, CAT,cat). I want to make a new field which has all the entries in all lower case. I ...
2
votes
2answers
120 views

Field Calculator, Conditional

I am trying to assign Value from one field of my Attribute table to a new field based on the 3d field.... The Code Block I am thinking about as follows: *def conditional (!FarmCateg!): if ...
2
votes
1answer
90 views

Extract characters inside parentheses in QGIS

I have a shapefile of the buildings on my college campus. It has a "name" field that includes the name of the building and then in parentheses the building's campus address (i.e. Health and ...
2
votes
1answer
406 views

How to use Field Calculator to calculate area as percentage?

I am searching for python code to use in Field Calculator to calculate area as a percentage in relation to another field? The area percentage needs be calculated based on the total area for each ...
2
votes
1answer
262 views

Calculate field result is float with Arc tool, integer with arcpy script

I am trying to calculate a field for some points within a python script using arcpy functions. (This is calculating the percentage visibility from a cumulative viewshed, if that matters.) # Process: ...
2
votes
2answers
462 views

Type mismatch error in Calculate Field tool in ArcGIS 10.1

I'm trying to run a rather lengthy model (built in ArcGIS 9.3.1) in ArcGIS 10.1 and I'm recieving an error on a Calculate Field tool. The error is - Type mismatch: 'iif'. This error is refering to ...
2
votes
2answers
594 views

Trimming Specific Text Values in QGIS Field Calculator

Sorry if this is a dumb question, but I am wondering if there is a way to copy the text from one field to a new field, but eliminate specific words. For example: **Old Field** ...
2
votes
1answer
75 views

ArcGIS 10.0, Field Calculator Nested “if” statement with strings

I need to assign a value depending on other two columns "FNP" and "Teilort". I wrote this script in phyton for field calculator. It actually works (no error messages) but the results in every cell is ...
2
votes
1answer
56 views

How to return end of string up to a certain character using Field Calculator?

I am trying to accomplish this task: http://stackoverflow.com/questions/15851568/how-to-get-the-last-part-of-a-string-before-a-certain-character within the Field Calculator. I have the below but ...
2
votes
2answers
199 views

Convert from Julian Date to Calender Date in Field Calculator

Does anyone know of a way to convert from a Julian date to a regular calender date in either QGIS or ArcGIS field calculator? Thanks...
2
votes
2answers
114 views

Conditional field calculator expression

I need to calculate the PIPEID field to equal the G_KEY_COMP field if PIPEID is null or PIPEID and G_KEY_COMP do not match. I think the first condition of the PIPEID being null is covered by the ...
2
votes
3answers
158 views

Calculate Field tool to calculate on null fields

I'm using ArcGIS 10.1. I want to use the calculate field tool in ModelBuilder on a table where if field1 is null, it should take the value of field2. If field1 has a value then it should stay as is. ...
2
votes
3answers
95 views

How to write FIDs of points within each polygon to polygon field?

I have two feature classes one with points one with polygons (in ArcGis 10.2). Now, I want to write into a String Field of the polygon layer a list of all the Point-FIDs that are within each polygon ...
2
votes
2answers
235 views

Capitalizing The First Letter Of Each Word In Attribute Field

Does anyone know of a way to capitalize the first letter of each word in a field in an attribute table? I am doing this in QGIS. I know of field calculations to change all the words to Lower or ...
2
votes
1answer
372 views

Am I over-complicating adding and then calculating fields? Suggestions for a better way? (Python)

I'm attempting to re-position a question I asked yesterday here. I am starting to think that the way I wrote my code just isn't the best way. Am I overcomplicating things? I know for a fact that ...
2
votes
1answer
2k views

ArcGIS 10.0 \ arcpy - CalculateField_management : help with syntax for updating text in attribute table of feature classes

I am trying to add (ie "Author", "LastUpdated") to feature classes within a gdb and then populate each of those fields. I have been able to get my code to run properly for the numerical field but I ...
2
votes
1answer
478 views

Field Calculate Degree Minute Second in Different Format

I have a field that is in degree minutes seconds, populated from ET Geowizards COGO Inverse tool. It populates the values as 90-12-28.15 where 90 is the degree, 12 is the minutes and 28.15 is the ...
2
votes
1answer
455 views

Field Calculator operation is not working

I've done this 100s of times and I can't understand why it won't work! I'm trying to copy the first 8 digits of from a HUC 12 (Hydrologic Unit Code) to a new field, which represents a larger ...
2
votes
1answer
1k views

Summing Attributes from a Related Table?

I have a line feature class representing road segments, with each road segment having a unique ID. This feature class has an attribute of average observed daily traffic counts. I have another table ...
2
votes
1answer
603 views

Does QGIS support parsing of date strings in tables?

It is straightforward to load GPX files (GPS downloaded tracks / points) into QGIS, then save and manipulate them as shapefiles. However, the recording date (in the comment (cmt) field) of waypoints ...
2
votes
3answers
27 views

Calculate field using variables as fields

When I calculate a field like this: field_0="field_name0" arcpy.CalculateField_management("Layer", field_0, '!field_name1! / !field_name2!', "PYTHON_9.3") It works! The field "field_name0" in the ...
2
votes
2answers
76 views

Returning value from other field, using FieldCalculator

I am very new to Python and need what I believe is a very basic script in order for my field to represent another fields' input, if the field's value is 0. I tried to search for this, but gave up ...
2
votes
4answers
100 views

Field Calculator Python Expression Issues

I'm pretty new to Python and this is my first post on this forum so I could use some help. I am currently attempting to run some code in the Field Calculator in a model in order to replace string ...
2
votes
1answer
54 views

Concatenate multiple string / text fields some of which may have NULL values ArcGIS

I am trying to repeat the behavior of this code from the ESRI website. I want to replicate the output example in ALL_Type field, so that it concatenates a field but it deals (ignores) any that have ...
2
votes
1answer
55 views

How to convert unix time to qt time type?

How can I convert unix timestamp to qt time type using qgis field calculator? I would like to avoid importing my table into excel and convert the timestamp to qt time type.
2
votes
1answer
303 views

How to compare string fields in the same table with ArcGIS 10

I don't know exactly if there is a tool for this or a maybe a python script could be more suitable. I want to compare string elements from a field (POI_NAME) with another string element in another ...
2
votes
1answer
107 views

Replace characters

How to remove a special number of characters of a string, e.g. the last 7 characters? And how to join them as the first characters to the string of another field? Thank you for VBS and Python synthax ...
2
votes
1answer
71 views

Decimal Degree data erases itself between edit sessions in QGIS

I have a shapefile with point data. I calculate the $x and $y of the points successfully I save the changes and close the edit session. Once I reopen the attribute table, the data after the decimal ...
2
votes
2answers
98 views

python add fields that may have NULL values

I would like to use python to calculate a field (short integer) using other fields (short integer) present in the table. In some cases these fields may have NULL values for one or more of the fields. ...
2
votes
1answer
66 views

Arcpy Calculate Field Formatting Syntax

I am trying to field calculate a double field (PID) to a new string field (PIN). Using: qry = '"139-{}".format(!PID!)' arcpy.CalculateField_management(out, "PIN", qry, "PYTHON") Given a PID = ...
2
votes
1answer
263 views

How to copy values from field to another using arcpy?

Can some one please let me know how I can do simple field calculation like Copying From "A" to "B" in ArcPy? I have found lots os example on web which they all used extra expression and they were ...
2
votes
1answer
89 views

Populate an attribute table field using the 'startswith function

I am hoping that someone may be able to help me. I am new to ArcGIS, and even newer to Python. Working in ArcGIS 10.1, I have done is created a new text field in an attribute table, which I have ...
2
votes
1answer
404 views

Calculating a field based on two other fields, if they exist [duplicate]

I'm using ModelBuilder to iterate through ~800 shapefiles to add and calculate a new field (I'll call it Field_A). Field_A needs to be populated by either Field_B or Field_C, whichever exists. Half of ...
2
votes
2answers
1k views

Use Feature Class “Name” from Iterate Feature Classes to Calculate Field with Model Builder 10.1

My goal is to create shapefile that contains merged feature classes from a geodatabase. I would like for there to be a new field in the resulting shapefile that contains the name of the original ...
2
votes
1answer
179 views

Need a Python field calculation that works like the DatePart( ) VB Function

I have a field called Abandoned Year (short integer data type) that I am trying to populate with a four digit year from a column called Decommission Date (Date data type). I have done this in the ...
2
votes
1answer
109 views

Syntax question for ArcGIS ICalculator object

This is a silly question, but I have this code snippet that I can't figure out: 'Define a calculator for NewArea field pCalculator = New Calculator With pCalculator .Cursor = pCursor ...
2
votes
3answers
792 views

Field calculator script not working

I am trying to do the following in the field calculator in ArcGIS 10 if [IncdStDir] = " " then [IncdStNo] &" " & [IncdStName] &" " & [IncdStSfx] else [IncdStNo] &" " & ...
2
votes
2answers
62 views

ArcGIS Field Calculator passes European-formatted floats as tuples

I have the problem that the ArcGIS Field Calculator doesn't read a float number when it is included in Python by referring to the field that contains it, in this way: def giveResult(floatValue): if ...
2
votes
2answers
126 views

How to calculate area of shapefile with a merged layer

so i have 'save as''d the new project and layer with my new Custom CRS project string being '+proj=laea +lat_0=70 +lon_0=0 +x_0=0 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs'. ...
2
votes
1answer
49 views

Populate field with current time

I am trying to populate a field with the current time. Here is what I tried that did not work: Start editing Open Attribute Table Add Field -> Name: time Type: Date Right Click on Field Name ...