How to auto-populate new field in attribute table?

6291
3
10-04-2020 01:42 PM
SarahBlake
New Contributor III

Hi.  I can't seem to figure out how to auto-populate a new field I created in an attribute table.  Using Desktop ArcMap 10.5.  The field I created is text and I want the entire field to be auto-populated with the same County name "Island".  I've tried multiple times using Field Calculator in an Edit session, typing "Island" in the script box or trying the command: Replace ([County], "  ", "Island") but always get a geoprocessing error "Failed to execute. Parameters are not valid." and "ERROR 000732".  Basically, I need to create a new field that specifies the county name which is the same for the entire feature class, and not sure why this seems so challenging...I must be missing something.  Other feature classes I have to do the same thing have over 4,000 point entries, so manual input of this field is not an option.  Any ideas?  -Sarah

0 Kudos
3 Replies
ManishPatel
Esri Contributor

Hi Sarah Blake,

Is it a new field you are creating? if so the current values should be Null.

You can use the Field Calculator and without using replace function you can directly try assigning the value.

"Island"

This should allow assigning the text value to all the records.

Hope this helps.

Cheers,

Manish


If this answer solved your question or if you found it helpful please mark it accordingly to help others who have the same question.

Cheers,
Manish
SarahBlake
New Contributor III

Hi, thanks Manish and Dan.  I just figured out my error...I had changed the name of my layer in the TOC from the shapefile name, so apparently Field Calculator doesn't like that.  I changed the name of my layer in the TOC to match the shapefile name and Field Calculator worked beautifully.  Thanks again! -Sarah

DanPatterson
MVP Esteemed Contributor

Sarah...

From...

Calculate Field (Data Management)—ArcGIS Pro | Documentation 

There is a paragraph that most people don't get to.  It should be highlighted in bold... or better still, correct in the source code...

To calculate strings to text or character fields, on the dialog box, the string must use double quotation marks ("string"), or in scripting, the string using double quotation marks must also be encapsulated in single quotation marks ('"string"').

Many a person has wasted time forgetting, or not seeing, this requirement.


... sort of retired...