Tagged Questions

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

1
vote
2answers
213 views

Autoincrementing Python Script is over writing all fields versus just fields that are null

Using ArcMap and the Field Calculator I have a python script that should autoincrement the FacilityID field if it is null. It works the first time through but the second run causes it to overwrite ...
0
votes
1answer
128 views

Replacing attribute table entries using python script. Script needed

I am using ArcMap 10 from ArcGIS 10.2.1 package. I got an attribute table, with few collumns. I need to replace some column "String_A" entries with newer "String_B" entries, in the same row. In both ...
2
votes
1answer
1k views

Getting ValueError: max() arg is an empty sequence on a Python Script in the Field Calculator in ArcMap

I have a script that populates a FacilityID Field on a Attribute table in the Field Calculator but when I run the script below I am getting a error. EDIT: Python Script: def autoInc(): import ...
0
votes
1answer
83 views

How to calculate/record attachments' file names using Field Calculator?

I have a point feature class containing attachments corresponding to jpg files (sometime more than one jpg per feature). I would like to use the "field calculator" to calculate/record a new field that ...
2
votes
2answers
127 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): ...
1
vote
1answer
46 views

Field Calculator extract three last digits from another field

How everyone! I have two fields the on is the cadastral number which is for example 051020213001 and I am trying to fill the other field (label) with the last 3 digits from the cadastral number, in ...
0
votes
3answers
83 views

Python QC field calculator

I am new to Python and am trying to run a simple QA/QC on a particular set of fields. I basically want to verify that fields x and y add up to z, I may have to incorporate rounding since a small ...
0
votes
1answer
108 views

How to use “this” Levenshtein Python code into ArcGIS 10

I need some help with this: First of all, I wanted to "Compare strings from two fields", and asking before at gis.stackexchange, in this post someone help me with this topic, referring me to a Python ...
2
votes
1answer
316 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 ...
0
votes
0answers
121 views

Using Code Block in Field Calculator with ArcObjects (VB.NET)

I'm having trouble using a code block in the Field Calculator with ArcObjects. Ideally, I'd like to be able to read a text file which contains the Python code for the code block. I've tested this code ...
2
votes
1answer
181 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 ...
1
vote
2answers
81 views

How to include a quotation mark in a text field from field calculator

I'm trying to attribute pipe size and need to include a quotation mark in a text field. How do I include that in the field calculator. "4"" doesn't work.
0
votes
2answers
474 views

ERROR 000989: Python syntax error: Parsing error SyntaxError: invalid syntax (line 2)

I have a Field Calculator I am using with Python and I keep getting the above error. Below is the screenshot of my Field Calculator I am using. What am I doing wrong here?
0
votes
2answers
92 views

Use Python lists in Field Calculator?

I couldn't find this question, although I am sure it has been asked. How could I use a python list to condense this script? This code block currently works, but is clearly not very efficient. def ...
1
vote
1answer
143 views

Auto increment a new column using Model Builder Field Calculator in QGIS?

I am making a model which requires creating a grid and clipping various layers to it. Using the Create grid function does not provide an ID column, instead it creates 2 columns: "longitude" and ...
2
votes
1answer
138 views

How do I add a column in an attribute table using QGIS graphical modeler?

I have started to make a model in QGIS 2.2 graphical modeler. I have made a buffer around a polyline and used it to clip a polygon layer. So far i t works. But the next step is to add a new column ...
1
vote
1answer
101 views

Error when dividing a field with a number

Using arcpy CalculateField_management i want to divide a field with a spacific number: arcpy.CalculateField_management(EZG_shp, "IDX_AT_PK", "(!EURO_SUM!/!Anz_Pers!)/1668,4","PYTHON") This works in ...
1
vote
2answers
224 views

How to populate a text field with double quotes using field calculator

How would I populate a text field with double quotes using the Field Calculator. For example, I want to populate a field as 24". Is there a way to populate fields using the field calculator with ...
0
votes
1answer
40 views

same or similar search word with field calculator

I am using arcgis 10.1 I have two tables A and B need to find attributes of table B data are on the table A I'm doing a join between table A and B now I want to use the field calculator via a script ...
0
votes
1answer
124 views

Error when calculate field using VBscript or Python (slice a field)

I have an expression in VBscript that works well for labeling: Function FindLabel (field) if (INT(RIGHT(field, 2)) <> 1) then FindLabel = INT(MID(field, 8, 3)) &"-"& ...
4
votes
1answer
171 views

How to use %value% (from For iterator) in SQL expression of Calculate Field in ModelBuilder?

I have a shapefile with data of fish specimens and the coordinates where they were tagged for research purposes. One of the fields in the attribute table of these shapefiles is the fish length in ...
0
votes
1answer
93 views

QGIS: graphical-modeler to calculate area of polygons

I'm trying to calculate the area of polygons using the field-calculator in QGIS (2.0.1). If I do this manualy it works fine, but if I do this using the graphical-modeler I get NULL as area for every ...
2
votes
1answer
110 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 ...
0
votes
1answer
44 views

How to use QGIS field calculator to delete style code?

I am struggling with following issue: How to delete style code before id codes x.x.xx.. and the }s in the end? Examples below. Any help appreciated! {\fArial|b1|i0|c0|p34;A.B.11} ...
0
votes
2answers
52 views

trying to add content to the middle of a string

I am trying to add content to the middle of a string by using MyStr = Mid([MyField], 1, 1) and I get an error. I've tried MyStr = Mid([_smallx], 63, 6) and MyStr = Mid(["_smallx"], 63, 6) The ...
4
votes
1answer
146 views

How to use Field Calculator to assign values to only Odd (or Even) page fields for Data Driven Pages?

I am creating a map book but do not want the page numbers for each map page to be on the same side (since its printed double sided), I need the page numbers to be placed on opposite sides? I am using ...
0
votes
2answers
600 views

ArcGis Python Script, Calculate Field

Sorry for my English. I am trying to write a Python Script for ArcGis 10.2. #import system modules import arcpy import math from arcpy import env #Set environment options ...
2
votes
2answers
468 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
2answers
212 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...
0
votes
0answers
41 views

Calculating rows in a attribute table of a point shape with QGis or Saga

I have a point shape with an attribut ("test"). I need to calculate the sum of the 1st four (id 1-4) "test" values and then the next 4 (id 5-8). Is there a chance to calculate this with the field ...
1
vote
1answer
51 views

Arcgis 10 assign values to field based on values in other field [duplicate]

I have a table with two fields A and B, and i want fill field B with "some values" from field A: FieldA: 123456_CC; 123_D; 1234567_AB; 123456768_F I just need the "text" that is associated with the ...
0
votes
1answer
314 views

Why does Field Calculator say failure during processing, check geoprocessing results window for details? [duplicate]

I am using the Field Calculator and keep receiving the following error: 'There was a failure during processing, check the geoprocessing results window for details'. I am not very tech-savvy but I have ...
0
votes
1answer
96 views

Parsing field in field calculator using Python

I have field1 which has a values of "A_B" (example). I created two fields out of this, values to the left of the underscore go in fielda and to the right of the underscore go in fieldb. I used the ...
0
votes
1answer
627 views

how to use the TRIM function in field calculator

I need to remove leading spaces in a field in my attribute table, but not how to do it from the field calculator
3
votes
1answer
227 views

Using Python in Field Calculator to compare two fields

I'm trying to use field calculator to compare two fields in a table of tax parcel data, Land Value (LAND_VAL) and Improvement Value (IMPRVT_VAL). My goal is to determine (1) Parcels with land value ...
2
votes
4answers
147 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
2answers
82 views

What's the use of the buffer function in field calculator?

I'm trying to find out how the buffer command in the filed calculator works. I tried to create a new field to my point shapefile (integer) with the following: buffer ($geometry, 100) but no ...
1
vote
0answers
20 views

Can a joined-layer have its attribute changed depending on what layers are selected/deselected?

Using QGIS, I have a polygon-grid layer which covers everything, Layer_All joined with 2 other grid layers: Layer_1 and Layer_2, both of which intersect at various points. I would like Layer_All to ...
2
votes
1answer
74 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 ...
1
vote
1answer
235 views

Null value error with Python in field calculator

I'm trying to calculate the angle between two line segments in ArcMap 10.0. I have a point shapefile, so I'm using the xy coordinates of 3 successive points to calculate the angle. I'm trying to use ...
0
votes
1answer
88 views

CalculateField_management - updating fields with X and Y coordinates for start and end of line

I've searched all the help documents and can't see where my script is going wrong. I've tried adding the fields as FLOAT, replacing "PYTHON_9_3" with just "PYTHON" but it just doesn't work. The ...
0
votes
1answer
88 views

Python field calc syntax error

The screenshot shows a calculate field tool in modelbuilder. The error I'm getting is invalid syntax line 1. I can't see any issues w/the syntax so I'm hoping someone out there can help. It ...
1
vote
1answer
72 views

Python in ArcGIS, CalculateField_management, updating with single value

I have a float field which I want to simply update all values with 1. I can easily do this within the field calculator but I have started using python today, what is the syntax to simply update a ...
3
votes
1answer
77 views

How do I add a field to a table using the QGIS graphic modeler?

I was wondering if anyone could help as I'm struggling to get anything out of the QGIS graphic modeler. For info I have no programming skills whatsoever. I need to be able to add a new field to an ...
2
votes
1answer
49 views

Expression to create and populate column based on filtered fields

I wanted to create a column and populate it with data based on data from other fields. If column_1 contains fields which has similar string (eg. field_1 = "Country: UK", field_2 = "Country: US", ...
1
vote
1answer
63 views

Create and immediately update field using Field Calculator

You can create fields and once created, populate them with data using the Field Calculator. But can you do both at the same time using an expression? Or must you do it in 2 steps?
3
votes
0answers
63 views

Using Field Calculator to Convert Data Type In Field

I am trying to convert a field that is listed as "String" because it was imported into QGIS as a CSV (rural poverty population percentages by county in NC). I need to convert the percentages field ...
-1
votes
1answer
108 views

IF-Statement in Field Calculator [closed]

I want to use an IF/ELSE-Statement to define a field in the attribute table of my raster. Therefore I have a field "VALUE". The condition should be: If "VALUE" < 4 ...then use die field "A".....if ...
0
votes
1answer
100 views

ArcMap Calculate Field..if “text” in !Field!

Is it possible to use Field Calculator in ArcGIS to add text to a new field based on an if in statement? Example: In an attribute table I have a some fields called !X!, !Y!, !Z! where "A (xx%)", "B ...
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 ...