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)

3
votes
3answers
343 views

Returning shape.area in code block of ArcGIS Field Calculator with if statement?

Using ArcGIS 10.1 for Desktop, I try to calculate a field using an 'if' statement in the field calculator. Here is my code : " #Expression MyField_2 = def Reclass(!MyField_1!) #Parser Python 9.3 #...
3
votes
3answers
843 views

Count the number of characters in a field (Python)

I have a field that contains street names and a second field called COUNT. I need to perform a Python field calculation on the COUNT field that counts the number of characters in the STREET_NAME ...
0
votes
0answers
38 views

Work values of a table in QGIS!

I have a table associated to a shapefile with the number of people who live in different villages and the corresponding city. I want to define a new shapefile with points located in the centroide of ...
2
votes
1answer
61 views

Field Calculator is not calculating selection from Make Feature Layer in arcpy

I am trying to use field calculator to calculate 3 different fields in python from a Make Feature Layer variable. It calculates the first field (MATERIAL_T) but then it doesn't calculate the second ...
2
votes
1answer
65 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 ...
1
vote
1answer
40 views

Multiple calculations with if then statements and NULL values

I'm trying to calculate a total demand in ArcGIS 10.2.2, stored in fields Demand1, Demand2, ... , Demand20. Some of them contain a numeric value. The others have a <Null> value. The sum ...
1
vote
1answer
44 views

Date different in field calculator using python method

I would like to calculate date different between two fields of date format. The idea is to know if Field_1 is greater than Field_2. My calculate code is something like this: def date(f1,f2): if f1 ...
5
votes
1answer
506 views

Converting 12-hour time to 24-hour time using Field Calculator

Does anyone know how to convert string time formats in ArcMap v10.2 from 12-hour to 24-hour using a simple query in the Field Calculator? i.e. NO Python, NO editing in Excel, NO changing my Windows PC ...
3
votes
2answers
71 views

Why is VBS If Then Label Expression not working?

I am trying to label a field based on other field. For [TYPE] = "PRIMARY", the [LABEL] is having this structure: "TAN80901B" For [TYPE] = "SECONDARY", the [LABEL] is like this: "TAN80901C/D20b" I ...
2
votes
4answers
2k views

VBScript - If/Then Statement - Field Calculator

I am trying to do a simple (or so I thought) if/then statement in the ArcGIS field calculator. I am trying to add the HydroCode field - hydologic soil codes - to an existing data set. I know what the ...
1
vote
1answer
84 views

If then else Logical VBScript in ArcMap 10.3.1

I realize this question has been asked in its basic form before, but I've tried a lot of code samples on answers posed to similar questions on this site to no avail. I'd like to create a new field ...
2
votes
2answers
167 views

QGIS 2.12 attribute table update question

I'm trying to fill in a whole lot of cells in the same column of an attribute table all at once using the field calculator. Am I on the right track with the following expression? "Author" || example ...
6
votes
1answer
2k 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 ...
0
votes
3answers
117 views

Python code help for ArcGIS Field Calculator tool (Model Builder)

Is there any python code that: 1st, sort a column (example name by alphabet) 2nd, grab the first cell of sorted column and assigned it to a variable like A=.. I need all of this to be done in field ...
4
votes
2answers
236 views

Script (ArcPy) vs field calculator (Python Parser) behaviour of getPart in ArcGIS for Desktop?

From time to time I have to access geometry field and shuffle through points in it. Process is simple: Get shape Get it's part Iterate through part's points This is how it looks like in a script ...
5
votes
3answers
605 views

Is there a way to close a geoprocessing operation when the dialog box has been hidden/pushed to the back of the window

Is there a way to close a geoprocessing operation when the dialog box has been hidden/pushed to the back of the windows? I ran a python process as VB Script and when the error message appeared I ...
1
vote
2answers
72 views

Using Calculate Field to fix hyperlinks in ArcPy gives Cannot use VB for services?

Getting an error while trying to script it, specifically "Cannot use VB for services." Snippet and VB code block as follows: Raw block (works within ArcMap): "\ftp\raw\YYYYMMDD\Files\Charles" +[NAME]...
0
votes
1answer
124 views

Replacing with Null in ArcGIS 10.3 [duplicate]

In ArcGIS 10.3 Desktop, how do you replace field values with Null using the Field Calculator without selecting the rows first? I'm able to select the rows that I want and calculate using the Field ...
1
vote
1answer
11k views

Find and replace, field calculator

Can someone show me a very simple find and replace in field calculator for just one or two characters in a field based hyperlink?
4
votes
1answer
82 views

Using UNC pathname with Calculate Field tool in ArcPy?

This question is different to Using Calculate Field to fix hyperlinks in ArcPy gives Cannot use VB for services? which was asked previously because it is using the Python parser specifically, rather ...
3
votes
2answers
216 views

Field calculator if and elseif statement with <Null> values in ArcGis 10.1

Trying to figure out how to get this "Headwater" column to indicate "Yes" (or 1) if the value of "NextDown_Copy" is "" and "No" (or 0) if it has any other value (eg. 7100381010). I attempted to ...
2
votes
1answer
89 views

Virtual fields are lost when duplicate layers

I've just upgraded to QGIS 2.12.3 - and hoped that the issue which was really time-consuming in 2.12. <3 could have been solved ... On duplicating layer - with tons of joined tables and virtual ...
3
votes
2answers
71 views

Field Calculator - conditional function and string variable?

I know this question has been asked before in different fashions, but I can't seem to get my python script to work despite looking at all the relevant questions I could find. I am simply trying to ...
2
votes
0answers
54 views

Finding and using mean and standard deviation value in field calculator

I am creating a field for a z-score of a particular attribute. This requires calculating the mean and the standard deviation for the attribute across all features. I've been using the statistics ...
3
votes
1answer
39 views

How to replace a directory using QGIS Field calculator?

I have a column called Hotlink full of incorrect directories and I need to edit them. They currently read C:/ABCD/filename.pdf and I want them to read C:/Maps/ABCD/ABCD/filename.pdf The script I'm ...
1
vote
2answers
99 views

Syntax error in parameter formula of field calculator funtion

I'm using a QGIS 2.8.1 in windows. Have some doubts with syntax when use string in python console. I want to use the field calculator funtion like: processing.runalg('qgis:fieldcalculator', input, ...
2
votes
1answer
538 views

Finding distance between consecutive points using ArcGIS Desktop?

I am wondering how I can get the distance between consecutive GPS locations in ArcMap 10 (i.e. the distance between consecutive GPS locations sent in during a wildlife telemetry study).
0
votes
0answers
10 views

Finding distance between consecutive points using ArcMap Field Calculator? [duplicate]

I am very new to ArcGIS but I am working on a data set consisting of GPS locations of radio tracked freshwater turtles. I am trying to find the distances between the points in order. Can someone ...
3
votes
1answer
131 views

QGIS Field Calculator functions

Using QGIS 2.12.3, within the Field Calculator "Geometry" section, there are certain functions, such as "area", that also have a corresponding term beginning with a dollar sign, i.e. "$area". I don't ...
1
vote
1answer
41 views

Iterating through list of fields using field calculator?

import arcpy, sys, itertools arcpy.env.workspace = r'path to geodatabase' fields1 = ['gearqty', 'cnemarea', 'fzone', 'qdsq', 'tensmsq', 'crew', 'nanglers', 'port', 'totalquant', 'trip_days', '...
0
votes
2answers
92 views

Calculating percentages in ArcGIS field calculator gives TypeError: 'float' object is not iterable?

I am trying to calculate the percent AREA in each class. I have created a new percentage field and have tried to populate it using the following equation in python in the calculate field tool. ...
1
vote
0answers
73 views

Converting Atn function of VB Script for Python parser of ArcGIS Field Calculator? [closed]

I would like to convert the Atn function (which returns the arctangent of a number) of VB Script to Python but I cannot find exactly the same function. Any help? I want to convert the slope of ...
2
votes
4answers
105 views

Calculate Length Totals in ArcGIS based on field values

I am having trouble finding the right words to describe this problem but here goes: I have 3 values (120,270,380) in my field called operatingvolt for every segment of conductor. Each segment of ...
1
vote
2answers
94 views

Calculate field more wisely

I first classified firstCol into groups and then I want to give the groups with different weighted values in another field, SecondCol. I will need to give different weighted values very often. I find ...
10
votes
2answers
1k views

Computing new attribute based on changes in another attribute using ArcGIS Desktop with Python?

I am attempting to classify a set of gps time-encoded point data into behaviors based on different attributes. I have created an attribute that is 0 for home and 1 for away based on location, and ...
15
votes
6answers
6k views

Find/Replace Double Quotes using Python Parser of ArcGIS Field Calculator?

I'm trying to use the Field Calculator (ArcMap 10.0) to strip out double quotes in an address field (I didn't put them in there, believe me). I've tried many incantations but am still unable to even ...
7
votes
1answer
10k views

Adding automated values to attribute field?

I have parcel and buildings layers. In their attribute tables I want to replace "NULL" values with numbers from 1 to 2000, in "Parcel ID", or "Building ID" field. How can I do this in ArcGIS ...
0
votes
1answer
605 views

Adding sequence numbering based on attributes in table? [duplicate]

Is there a way to auto populate a sequence of numbers based on another attribute in a table? For example, if field "Name" has a sequence of numbers from 1 to 10, and I want to number all the rows in ...
1
vote
1answer
43 views

Calculating average values of condition or receive values from a table for calculation in another table

I have a table with data (in this example the field "TSS"), a field time corresponds to the data for each point. I want to create a field with the mean values for each point all time values, without ...
1
vote
1answer
4k views

Concatenating fields using VBscript in ArcGIS Field Calculator?

I'm trying to get one column of text to move into another column that already has text. I DON'T want to replace it, I want the transferring text to be added to the already existing text in a shp file ...
2
votes
3answers
162 views

If else if in ArcMap Field Calculator (Python)

Help! I think I am missing something that must be so obvious but I cannot figure out what I am doing wrong. Here's some background: I have one short integer field (MajAspNum) that has values 1-10....
2
votes
4answers
101 views

IF else statements arcmap, using python

I have a shapefile with a number of fields. I have one field (let's call it Field A) that I need to populate based on another field (let's call it Field B). If Field B is greater then 0 I need it ...
2
votes
1answer
95 views

QGIS processing toolbox: fieldcalculator - update only selected features is not possible

I am working on a model where I need some calculations on only some selected features. In the normal fieldcalculator you can check 'only update ... selected features'. When using the fieldcalculator ...
3
votes
1answer
55 views

QGIS - Field Calculator: scale_linear gives unexpected result

When I try to use scale_linear, its output isn't as I expected. My values are from 1 to 16, so I set domain_min = 1 and domain_max = 16. I want to interpolate to interval from 1 to 4 so I set ...
2
votes
1answer
108 views

Running ArcGIS field calculation using Python with algebraic expression using other field values as variables?

I'm trying to run a field calculation using multiple fields in a table as well as independent numeric values with python code in the field calculator window. I've included the first 7 lines of the ...
2
votes
1answer
82 views

Rename cells in Attribute Table to 'XXX.$ID'

I feel like this should be easy to answer, but I can't get it to work for me. I need to edit the attribute table of a .gpx file before I load it into my GPS, in order to label the points. I can rename ...
1
vote
2answers
80 views

How to compute the distance from the current polygon centroid to another in QGIS field calculator?

There is layer with polygons. I want to save in new field distance of every polygon's centroid to centroid of one particular polygon. To do this I should write some expression like this: distance(...
2
votes
2answers
94 views

type mismatch: 'esri_8' when using field calculator

I am trying to run the VBScript 'round' function using the field calculator on a column for a numeric field that contains a large number of rows (> 500k). When I run the code on a subset of the field ...
3
votes
3answers
85 views

Can't replace attribute with field calculator

I have an attribute table where one of the columns (laeskaerm) has been edited/created by checkboxes on 2 different machines. Result: it contains both 1, 0, true, false and NULL I'd like to replace ...
3
votes
1answer
3k views

Selecting by attribute and calculating field of new selection in ModelBuilder?

I have a polygon shapefile (with 4000 records in it) that I want to group into different regions by doing a "select by attribute". I need to do this about 164 times because of the different selection ...