ArcGIS 10.6 ArcPython Update Cursor Not Populating Field Planned maintenance scheduled April...
White walkers, cemeteries and wights
"klopfte jemand" or "jemand klopfte"?
Test print coming out spongy
How do living politicians protect their readily obtainable signatures from misuse?
Monty Hall Problem-Probability Paradox
Random body shuffle every night—can we still function?
Special flights
Why is it faster to reheat something than it is to cook it?
How to ternary Plot3D a function
The Nth Gryphon Number
Delete free apps from library
Did any compiler fully use 80-bit floating point?
Can two person see the same photon?
Would color changing eyes affect vision?
License to disallow distribution in closed source software, but allow exceptions made by owner?
Simple Http Server
Was Kant an Intuitionist about mathematical objects?
Differences to CCompactSize and CVarInt
I can't produce songs
What is the difference between CTSS and ITS?
Why datecode is SO IMPORTANT to chip manufacturers?
Is CEO the "profession" with the most psychopaths?
My mentor says to set image to Fine instead of RAW — how is this different from JPG?
How many time has Arya actually used Needle?
ArcGIS 10.6 ArcPython Update Cursor Not Populating Field
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?Auto-incrementing attribute fields using ArcPy cursors and conditional statements?Update Cursor not updating field correctlyUsing Update Cursor, populate fieldUpdate cursor with not populating table with describe/xml metadataReplace field values with arcpy update cursorOptimizing Field Update - Update Cursor, ArcPyUpdate Cursor Script Not RunningPopulating multiple fields from string using Update Cursor?Adding field which, depending on direction field value, gets value from previous or next row/feature in another field?Comparing value with value from the next row
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I recognize similar questions have been asked but I have yet to see what my code is lacking in any of their answers.
I am trying to use the code below to periodically update attributes in a Feature Class that is often added to during our survey. The goal is every time the 'SBP Anomaly' or 'BS Anomaly' is present in the 'Target_Typ' column a sequential integer will be marked in the 'SBP_Num' and 'BCKSCTR_Nu'(Better name forthcoming) columns respectively.
The first two 'for loops' under my Update Cursor are operating correctly, however, the third doesn't update/populate its target fields when the conditions are met.
import arcpy
fc = arcpy.GetParameterAsText(0)
fields = ['Target_num','Target_Typ','WCA_Label', 'BCKSCTR_Nu', 'SBP_Num' ]
i = 1
x = 1
s = 1
with arcpy.da.UpdateCursor(fc,fields) as rows:
for y in rows:
y[0] = x
x+=1
rows.updateRow(y)
for row in rows:
if row[2] != None and row[1] != 'SBP Anomaly':
row[1] = "WC Anomaly"
else:
row[1] = "BS Anomaly"
rows.updateRow(row)
for TypeCount in rows:
if row[1] == 'SBP Anomaly':
row[4] = int(s)
s += 1
elif row[1] == 'BS Anomaly':
row[3] = int(i)
i += 1
else:
pass
rows.updateRow(TypeCount)
del rows
An image of the attribute table I am trying to manipulate is included also for reference.
I have made sure the Target fields for third 'for loop' are set up as the correct object type: short integers (at least I think that's appropriate
) and not strings so they should take the integers i/s. I have tried them as strings and Long integers, and even float one time.
arcpy arcgis-10.6
add a comment |
I recognize similar questions have been asked but I have yet to see what my code is lacking in any of their answers.
I am trying to use the code below to periodically update attributes in a Feature Class that is often added to during our survey. The goal is every time the 'SBP Anomaly' or 'BS Anomaly' is present in the 'Target_Typ' column a sequential integer will be marked in the 'SBP_Num' and 'BCKSCTR_Nu'(Better name forthcoming) columns respectively.
The first two 'for loops' under my Update Cursor are operating correctly, however, the third doesn't update/populate its target fields when the conditions are met.
import arcpy
fc = arcpy.GetParameterAsText(0)
fields = ['Target_num','Target_Typ','WCA_Label', 'BCKSCTR_Nu', 'SBP_Num' ]
i = 1
x = 1
s = 1
with arcpy.da.UpdateCursor(fc,fields) as rows:
for y in rows:
y[0] = x
x+=1
rows.updateRow(y)
for row in rows:
if row[2] != None and row[1] != 'SBP Anomaly':
row[1] = "WC Anomaly"
else:
row[1] = "BS Anomaly"
rows.updateRow(row)
for TypeCount in rows:
if row[1] == 'SBP Anomaly':
row[4] = int(s)
s += 1
elif row[1] == 'BS Anomaly':
row[3] = int(i)
i += 1
else:
pass
rows.updateRow(TypeCount)
del rows
An image of the attribute table I am trying to manipulate is included also for reference.
I have made sure the Target fields for third 'for loop' are set up as the correct object type: short integers (at least I think that's appropriate
) and not strings so they should take the integers i/s. I have tried them as strings and Long integers, and even float one time.
arcpy arcgis-10.6
add a comment |
I recognize similar questions have been asked but I have yet to see what my code is lacking in any of their answers.
I am trying to use the code below to periodically update attributes in a Feature Class that is often added to during our survey. The goal is every time the 'SBP Anomaly' or 'BS Anomaly' is present in the 'Target_Typ' column a sequential integer will be marked in the 'SBP_Num' and 'BCKSCTR_Nu'(Better name forthcoming) columns respectively.
The first two 'for loops' under my Update Cursor are operating correctly, however, the third doesn't update/populate its target fields when the conditions are met.
import arcpy
fc = arcpy.GetParameterAsText(0)
fields = ['Target_num','Target_Typ','WCA_Label', 'BCKSCTR_Nu', 'SBP_Num' ]
i = 1
x = 1
s = 1
with arcpy.da.UpdateCursor(fc,fields) as rows:
for y in rows:
y[0] = x
x+=1
rows.updateRow(y)
for row in rows:
if row[2] != None and row[1] != 'SBP Anomaly':
row[1] = "WC Anomaly"
else:
row[1] = "BS Anomaly"
rows.updateRow(row)
for TypeCount in rows:
if row[1] == 'SBP Anomaly':
row[4] = int(s)
s += 1
elif row[1] == 'BS Anomaly':
row[3] = int(i)
i += 1
else:
pass
rows.updateRow(TypeCount)
del rows
An image of the attribute table I am trying to manipulate is included also for reference.
I have made sure the Target fields for third 'for loop' are set up as the correct object type: short integers (at least I think that's appropriate
) and not strings so they should take the integers i/s. I have tried them as strings and Long integers, and even float one time.
arcpy arcgis-10.6
I recognize similar questions have been asked but I have yet to see what my code is lacking in any of their answers.
I am trying to use the code below to periodically update attributes in a Feature Class that is often added to during our survey. The goal is every time the 'SBP Anomaly' or 'BS Anomaly' is present in the 'Target_Typ' column a sequential integer will be marked in the 'SBP_Num' and 'BCKSCTR_Nu'(Better name forthcoming) columns respectively.
The first two 'for loops' under my Update Cursor are operating correctly, however, the third doesn't update/populate its target fields when the conditions are met.
import arcpy
fc = arcpy.GetParameterAsText(0)
fields = ['Target_num','Target_Typ','WCA_Label', 'BCKSCTR_Nu', 'SBP_Num' ]
i = 1
x = 1
s = 1
with arcpy.da.UpdateCursor(fc,fields) as rows:
for y in rows:
y[0] = x
x+=1
rows.updateRow(y)
for row in rows:
if row[2] != None and row[1] != 'SBP Anomaly':
row[1] = "WC Anomaly"
else:
row[1] = "BS Anomaly"
rows.updateRow(row)
for TypeCount in rows:
if row[1] == 'SBP Anomaly':
row[4] = int(s)
s += 1
elif row[1] == 'BS Anomaly':
row[3] = int(i)
i += 1
else:
pass
rows.updateRow(TypeCount)
del rows
An image of the attribute table I am trying to manipulate is included also for reference.
I have made sure the Target fields for third 'for loop' are set up as the correct object type: short integers (at least I think that's appropriate
) and not strings so they should take the integers i/s. I have tried them as strings and Long integers, and even float one time.
arcpy arcgis-10.6
arcpy arcgis-10.6
edited 19 secs ago
ckhartma621
asked 5 mins ago
ckhartma621ckhartma621
12
12
add a comment |
add a comment |
0
active
oldest
votes
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
});
}
});
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%2f319433%2farcgis-10-6-arcpython-update-cursor-not-populating-field%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
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%2f319433%2farcgis-10-6-arcpython-update-cursor-not-populating-field%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