Using If statements to conditionally populate a field in Field CalculatorFnding wildcard string using Field Calculator script code?Basic Python Reclass question in Field CalculatorAssign field values (double) based on values of other field (string) using field calculatorUsing Field Calculator with Python Parser and if/elif statements in ArcGIS for Desktop?Concatenate fields in Field Calculator using PythonField Calculator error: “calculated value is invalid”Multiple Conditionals String with ArcGIS Field Calculator?Python in field calculator parsing errorVBA/Python If/then statements in Field Calculator for one column based on another not workingField calculator returning ERROR 000989?
If two black hole event horizons overlap (touch) can they ever separate again?
Have any large aeroplanes been landed — safely and without damage — in locations that they could not be flown away from?
What is quadratization?
Losing queen and then winning the game
Reusable spacecraft: why still have fairings detach, instead of open/close?
How do I ensure my employees don't abuse my flexible work hours policy?
Two palindromes are not enough
What is an acid trap
Adjective for 'made of pus' or 'corrupted by pus' or something of something of pus
If I have the War Caster feat, can I use the Thorn Whip cantrip to stop an enemy caster from escaping using the Dimension Door spell?
Is there a way to convert blue ice back into packed ice?
if a USA citizen marries a foreign citizen who has kid from previous marriage
On the geometric Hahn-Banach theorem
Copy group of files (Filename*) to backup (Filename*.bak)
What do you call a notepad used to keep a record?
Most elegant way to write a one-shot 'if'
Why can't you move another user's directory when you can move their file?
Should 私の be omitted?
Ways to get SMD resistors from a strip
/etc/hosts not working
Is it okay to fade a human face just to create some space to place important content over it?
Can I use Alchemist's fire to turn my sword into a virtual Flame Blade?
Can a stressful Wish's Strength reduction be cured early by a Greater Restoration spell?
Why would anyone even use a Portkey?
Using If statements to conditionally populate a field in Field Calculator
Fnding wildcard string using Field Calculator script code?Basic Python Reclass question in Field CalculatorAssign field values (double) based on values of other field (string) using field calculatorUsing Field Calculator with Python Parser and if/elif statements in ArcGIS for Desktop?Concatenate fields in Field Calculator using PythonField Calculator error: “calculated value is invalid”Multiple Conditionals String with ArcGIS Field Calculator?Python in field calculator parsing errorVBA/Python If/then statements in Field Calculator for one column based on another not workingField calculator returning ERROR 000989?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I'm trying to use the field calculator to poplulate a string field in a table based on info in another string field. This is what I have:
def Reclass(Correction_Comments):
if (MSAGSTREETNAME) = 'HEMLOCK':
return 'IN PARCEL 103'
In the call box:
Reclass( !Correction_Comments!)
I keep getting a parsing error. What's wrong?
arcgis-desktop field-calculator python-parser
New contributor
CamelAce is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
I'm trying to use the field calculator to poplulate a string field in a table based on info in another string field. This is what I have:
def Reclass(Correction_Comments):
if (MSAGSTREETNAME) = 'HEMLOCK':
return 'IN PARCEL 103'
In the call box:
Reclass( !Correction_Comments!)
I keep getting a parsing error. What's wrong?
arcgis-desktop field-calculator python-parser
New contributor
CamelAce is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
I'm trying to use the field calculator to poplulate a string field in a table based on info in another string field. This is what I have:
def Reclass(Correction_Comments):
if (MSAGSTREETNAME) = 'HEMLOCK':
return 'IN PARCEL 103'
In the call box:
Reclass( !Correction_Comments!)
I keep getting a parsing error. What's wrong?
arcgis-desktop field-calculator python-parser
New contributor
CamelAce is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I'm trying to use the field calculator to poplulate a string field in a table based on info in another string field. This is what I have:
def Reclass(Correction_Comments):
if (MSAGSTREETNAME) = 'HEMLOCK':
return 'IN PARCEL 103'
In the call box:
Reclass( !Correction_Comments!)
I keep getting a parsing error. What's wrong?
arcgis-desktop field-calculator python-parser
arcgis-desktop field-calculator python-parser
New contributor
CamelAce is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
CamelAce is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited 8 hours ago
BERA
19.1k6 gold badges21 silver badges46 bronze badges
19.1k6 gold badges21 silver badges46 bronze badges
New contributor
CamelAce is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 8 hours ago
CamelAceCamelAce
132 bronze badges
132 bronze badges
New contributor
CamelAce is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
CamelAce is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
The parameter "Correction_Comments" from your function is not used at all within the function. Instead, there is a variable "MSAGSTREETNAME", a local variable that is not referenced elsewhere. In addition, the if statement is using an assignment (=) rather than a test (==).
Modifications:
def Reclass(streetnamefield):
if streetnamefield == 'HEMLOCK':
return 'IN PARCEL 103'
Reclass( !Correction_Comments!)
This will pass the field Correction_Comments into your Reclass function. You may instead want to run this in the Field Calculator for the Correction_Comments field, against the MGAGSTREETNAME field e.g. right click Correction_Comments, Field Calculator, and run with Reclass(!MGAGSTREETNAME!).
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "79"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
CamelAce is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f327099%2fusing-if-statements-to-conditionally-populate-a-field-in-field-calculator%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The parameter "Correction_Comments" from your function is not used at all within the function. Instead, there is a variable "MSAGSTREETNAME", a local variable that is not referenced elsewhere. In addition, the if statement is using an assignment (=) rather than a test (==).
Modifications:
def Reclass(streetnamefield):
if streetnamefield == 'HEMLOCK':
return 'IN PARCEL 103'
Reclass( !Correction_Comments!)
This will pass the field Correction_Comments into your Reclass function. You may instead want to run this in the Field Calculator for the Correction_Comments field, against the MGAGSTREETNAME field e.g. right click Correction_Comments, Field Calculator, and run with Reclass(!MGAGSTREETNAME!).
add a comment |
The parameter "Correction_Comments" from your function is not used at all within the function. Instead, there is a variable "MSAGSTREETNAME", a local variable that is not referenced elsewhere. In addition, the if statement is using an assignment (=) rather than a test (==).
Modifications:
def Reclass(streetnamefield):
if streetnamefield == 'HEMLOCK':
return 'IN PARCEL 103'
Reclass( !Correction_Comments!)
This will pass the field Correction_Comments into your Reclass function. You may instead want to run this in the Field Calculator for the Correction_Comments field, against the MGAGSTREETNAME field e.g. right click Correction_Comments, Field Calculator, and run with Reclass(!MGAGSTREETNAME!).
add a comment |
The parameter "Correction_Comments" from your function is not used at all within the function. Instead, there is a variable "MSAGSTREETNAME", a local variable that is not referenced elsewhere. In addition, the if statement is using an assignment (=) rather than a test (==).
Modifications:
def Reclass(streetnamefield):
if streetnamefield == 'HEMLOCK':
return 'IN PARCEL 103'
Reclass( !Correction_Comments!)
This will pass the field Correction_Comments into your Reclass function. You may instead want to run this in the Field Calculator for the Correction_Comments field, against the MGAGSTREETNAME field e.g. right click Correction_Comments, Field Calculator, and run with Reclass(!MGAGSTREETNAME!).
The parameter "Correction_Comments" from your function is not used at all within the function. Instead, there is a variable "MSAGSTREETNAME", a local variable that is not referenced elsewhere. In addition, the if statement is using an assignment (=) rather than a test (==).
Modifications:
def Reclass(streetnamefield):
if streetnamefield == 'HEMLOCK':
return 'IN PARCEL 103'
Reclass( !Correction_Comments!)
This will pass the field Correction_Comments into your Reclass function. You may instead want to run this in the Field Calculator for the Correction_Comments field, against the MGAGSTREETNAME field e.g. right click Correction_Comments, Field Calculator, and run with Reclass(!MGAGSTREETNAME!).
answered 8 hours ago
smillersmiller
2,8505 silver badges17 bronze badges
2,8505 silver badges17 bronze badges
add a comment |
add a comment |
CamelAce is a new contributor. Be nice, and check out our Code of Conduct.
CamelAce is a new contributor. Be nice, and check out our Code of Conduct.
CamelAce is a new contributor. Be nice, and check out our Code of Conduct.
CamelAce is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Geographic Information Systems Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f327099%2fusing-if-statements-to-conditionally-populate-a-field-in-field-calculator%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown