Field calculators (available in QGIS, ArcGIS Desktop, etc) can recalculate the values of a single field on all, or selected, records within a table using an expression.

learn more… | top users | synonyms (1)

2
votes
1answer
170 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
191 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
3k views

Using Feature Class “Name” from Iterate Feature Classes to Calculate Field with ModelBuilder?

I am using ArcGIS 10.1 for Desktop. 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 ...
2
votes
2answers
560 views

Stop rounding values in Qgis attribute table

I am calculating the areas of my polygons in Qgis using $area and everything works fine until I click on "save". All my values are rounded to an integer. I tired setting the output field type to ...
2
votes
1answer
549 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
736 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
770 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
1answer
1k views

Putting multiple lines of Python into ArcGIS 10's Field Calculator

I've gotten some incredibly valuable help here on this already, much Thanks. Entering these lines of Python one at a time works like a charm.... Just need one more seemingly simply issue solved... ...
2
votes
1answer
52 views

Python if, and, or to compare field values and assign new value

I have 3 fields in a table that i need to evaluate and return a new value based on the results using the field calculator (PYTHON) They are: SETSPAID (long) This field must = 0 TYPEOFSERVICE (string)...
2
votes
1answer
51 views

Referencing other points(rows) in field calculator

I'm trying to calculate an angle between points using a field calculator. Is it possible to reference the previous or next FID with reference to the current one using the field calc? Eventually I'd ...
2
votes
1answer
56 views

Concatenate fields in Field Calculator using Python [duplicate]

I'm trying to concatenate fields together and used this post as a guide: <Adding hyphen in ArcGIS Field Calculator to merge two columns?> ; however, I'm still getting a 989 parsing error. Here's ...
2
votes
1answer
30 views

Field Calculator unexpectedly results in integer or decimal, depending on input

In model build, I have the following Field Calculator tool running: You can see in the results below that when the calculation involves a decimal, the output shows 6 decimal points, but when the ...
2
votes
1answer
70 views

How to use the field calculator in QGIS to determine the total of differents fields

I have an attribute table with 7 fields. I want my attribute " A1 " to be the total of " IP1 to IP5 ". I am not familiar with the request in the field calculator. How can I calculate the value of ...
2
votes
1answer
66 views

get day and time from date field with time, with field calculator

I'm using ArcGIS 10.1 and have a field containing a date and time I need to get the day of the week based on my date field and also when the same field that contains date and time I need to do this ...
2
votes
1answer
68 views

Python codeblock to remove numeric characters from a column not working

I am trying to make use of a codeblock found in this thread: How to remove numeric characters from alphanumeric value in field calculation? I put this code into the pre-logic script field of the ...
2
votes
1answer
237 views

Copy first row of attributes and paste for each feature

In a newly digitised polyline vector layer, there are 7 columns attributes value that are choosen inside a value map combo-box that MUST be exactly the same for every newly digitised line (I choose ...
2
votes
1answer
89 views

Replace Expression in Field Calculator to include a Numeric Range

There has to be an easier way to clean up address data, I hope? GeoCoding, I need to remove APT# and any number or letter that follows.
2
votes
2answers
656 views

Cannot convert string to int using ArcPy Calculate Field

When I load a csv file to join with ArcPy, it converts all string fields that are numeric to integers. Therefore, I have to add another field within the feature class that I'm using for joining that ...
2
votes
1answer
50 views

Unexpected behaviour when summarizing a field in ArcMap (Un-Equal strings)

I couldn't figure out why when I use summarize the Field " LandUse_Arabic " it the summary shows two identical values in the output table. But when I use select by attribute, despite the fact ...
2
votes
1answer
2k views

Converting values in datetime field to strings in text field using Python parser of ArcGIS for Desktop?

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 ...
2
votes
2answers
79 views

select parcels in polygons and add fiels depending on the polygons

I have a lot of feature classes (results of service area with different polygons (0 to 10/ 10 to 20/ 20 to 40 and 40 to 60) (figure 1) Also i have a shapefile with a lot of parcels (figure 2) ...
2
votes
1answer
165 views

Add a certain number of days for a date field

I have one field for a permit decision date, and then I have another field for 180 days from that permit date. The permit date field has data entered, but the 180 day field I would like to calculate ...
2
votes
1answer
156 views

Subtracting columns (that include null values) in ArcMap Field Calculator

I’m desperately trying to run a very simple command where I subtract one column with others. However the problem is that some rows have NULL values, therefore the result of subtracting is also NULL. I'...
2
votes
1answer
181 views

What is the expression for getting a subset of characters in QGIS Field Calculator?

I have a column of 10 character names e.g. L3NAM1988K. How can I delete the first 5 characters and the last 1 character using an expression in the QGis Field Calculator?
2
votes
1answer
131 views

Converting Aspect degree to westness

I have extracted Aspect values in degree from DEM in ArcMap 10.2 full license. I want to investigate effect of Westness in my model so I was using conversion formula of Folded Aspect : ABS (180- ABS(...
2
votes
1answer
78 views

Referencing fields in code block of Field Calculator in ArcGIS for Desktop?

I'm trying to use values from a field to fill a new field with a truncated version. The 'str.rindex' function is working out well, but I can't seem to figure out how I'm supposed to reference the ...
2
votes
2answers
111 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
421 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
177 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
1k 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
236 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
2answers
3k views

How to use DateDiff() Function across day transition in ArcGIS Field Calculator?

I am trying to calculate the time difference between two fields using the DateDiff() function in minutes. I have successfully calculated the times that fall within the same day but I am having trouble ...
2
votes
1answer
130 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
1answer
131 views

Scoring fields between 0 and 1 using ArcGIS field calculator?

I am starting to get to know ArcGIS 10.2.1 and I need to the following, but I am not sure how to build the expression into the FIELD CALCULATOR: I need to add first a new field called ...
2
votes
2answers
329 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
243 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
148 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
1k 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
3answers
4k views

Python script for identifying duplicate records (follow up)

I am trying to calculate a field that marks duplicates and sequentially numbers them. I am using the code below that I found here: Generating sequential numbering for duplicate values in a field ...
2
votes
1answer
1k views

Generating sequential numbering for duplicate values in a field sorted by ObjectID

I am trying to figure out a solution to an field calculation problem. What I'm trying to do is automatically (using either ArcPy or the Field Calculator) generate sequential numbers, beginning at 1, ...
2
votes
1answer
449 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
153 views

using “abs()” function in QGIS field calculator?

I'm pretty new to GIS in general and I'm trying to take an absolute value of the difference between two fields in field calculator when creating a new field, but using ABS () returns an invalid ...
2
votes
1answer
2k views

Incorrect field name resulted in RuntimeError: ERROR 999999 (Also, better code for adding and calculating fields)

This is the bottom half of my code (and it's been edited somewhat to share publicly). The code works perfectly fine when the fieldList has only three fields in it, but when I populate it with all 108 ...
2
votes
1answer
279 views

Syntax for ArcGIS ICalculator object?

I have a code snippet that I can't figure out: 'Define a calculator for NewArea field pCalculator = New Calculator With pCalculator .Cursor = pCursor .PreExpression = "Dim ...
2
votes
3answers
875 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
2k views

Recoding values based on contents using ArcGIS Field Calculator or Python?

Is there a convenient (or even effective) method for recoding field values using the field calculator or standalone python script? In this case, I am given several unique strings to identify a type ...
2
votes
1answer
46 views

QGIS Calculate Field with Function Editor invalid expression

I have some data which is built like this: a,bbb,ccc where bbb and ccc vary in length. I want to extract the last segment of the string, after the second ",". Using the Function Editor: from qgis....
2
votes
1answer
37 views

QGIS Field Pyculator Reclass

I'm new to the QGIS Pyculator and need to reclass a field ('AP') based on another field ('Mag'). What I have so far, from the ArcGIS field calculator: def Reclass(Mag,AP): if Mag>= 2000: ...
2
votes
1answer
157 views

Calculating angle between polyline segments and assign this value to point?

I have a polyline feature with many segments (polyline split at vertices). I plan to record angle values to attribute table per each polyline segment and assign it to point features. I need to ...
2
votes
3answers
62 views

Stacking multiple selected points in ArcGIS

I would like to find a way to stack multiple selected points in ArcGIS, either using the field calculator or python script. For example, I want to snap all points representing houses on a street into ...