Checking field is empty and then adding new row with zeros? The 2019 Stack Overflow Developer...
How technical should a Scrum Master be to effectively remove impediments?
Where to refill my bottle in India?
Can we generate random numbers using irrational numbers like π and e?
"as much details as you can remember"
If a Druid sees an animal’s corpse, can they wild shape into that animal?
How to support a colleague who finds meetings extremely tiring?
Is this app Icon Browser Safe/Legit?
During Temple times, who can butcher a kosher animal?
Why isn't the circumferential light around the M87 black hole's event horizon symmetric?
Does the shape of a die affect the probability of a number being rolled?
Why did Acorn's A3000 have red function keys?
Falsification in Math vs Science
Why do we hear so much about the Trump administration deciding to impose and then remove tariffs?
Worn-tile Scrabble
Apparent duplicates between Haynes service instructions and MOT
Write faster on AT24C32
Can you compress metal and what would be the consequences?
Does a dangling wire really electrocute me if I'm standing in water?
Why was M87 targetted for the Event Horizon Telescope instead of Sagittarius A*?
How to save as into a customized destination on macOS?
Return to UK after being refused entry years previously
Can a rogue use sneak attack with weapons that have the thrown property even if they are not thrown?
Why isn't airport relocation done gradually?
Protecting Dualbooting Windows from dangerous code (like rm -rf)
Checking field is empty and then adding new row with zeros?
The 2019 Stack Overflow Developer Survey Results Are InHow to calculate field as cursor name?How to check for empty values in fields of a featureclass?Getting first and second row with ArcPy searchcursor?ArcPy Calculate Null Values to Zero in Multiple FieldsImport csv value to an empty field in a point feature classPass list parameter to SQL expressionUsing SearchCursor - TypeError: Not a Spatial ReferenceSearch Cursor Return Field Name If All Rows Contain a ValueUsing ArcPy to ListFields inside SearchCursor?Switching from Nested Search Cursors to Dictionaries
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I created a table with three fields but there are no values in these fields. Here is the screenshot of these fields.
I want to add a new row with zeros for all these three fields. Here is my code.
with arcpy.da.UpdateCursor(selectionname,("OBJECTID","FREQUENCY","SUM_Shape_Area")) as cursor:
for row in cursor:
if row[0] == None:
row[0] = 0
cursor.updateRow(row)
else:
print selectionname + " is not empty"
Selectionname is my table, a parameter defined prior to this part of my code. After several tries, I still could not add a new row to the table.
arcpy arcgis-10.0 cursor
add a comment |
I created a table with three fields but there are no values in these fields. Here is the screenshot of these fields.
I want to add a new row with zeros for all these three fields. Here is my code.
with arcpy.da.UpdateCursor(selectionname,("OBJECTID","FREQUENCY","SUM_Shape_Area")) as cursor:
for row in cursor:
if row[0] == None:
row[0] = 0
cursor.updateRow(row)
else:
print selectionname + " is not empty"
Selectionname is my table, a parameter defined prior to this part of my code. After several tries, I still could not add a new row to the table.
arcpy arcgis-10.0 cursor
To add a new row you need to be using an InsertCursor. If you are using ArcGIS Desktop 10.0 then you cannot be using arcpy.da because it did not exist until 10.1. What version are you using?
– PolyGeo♦
6 mins ago
add a comment |
I created a table with three fields but there are no values in these fields. Here is the screenshot of these fields.
I want to add a new row with zeros for all these three fields. Here is my code.
with arcpy.da.UpdateCursor(selectionname,("OBJECTID","FREQUENCY","SUM_Shape_Area")) as cursor:
for row in cursor:
if row[0] == None:
row[0] = 0
cursor.updateRow(row)
else:
print selectionname + " is not empty"
Selectionname is my table, a parameter defined prior to this part of my code. After several tries, I still could not add a new row to the table.
arcpy arcgis-10.0 cursor
I created a table with three fields but there are no values in these fields. Here is the screenshot of these fields.
I want to add a new row with zeros for all these three fields. Here is my code.
with arcpy.da.UpdateCursor(selectionname,("OBJECTID","FREQUENCY","SUM_Shape_Area")) as cursor:
for row in cursor:
if row[0] == None:
row[0] = 0
cursor.updateRow(row)
else:
print selectionname + " is not empty"
Selectionname is my table, a parameter defined prior to this part of my code. After several tries, I still could not add a new row to the table.
arcpy arcgis-10.0 cursor
arcpy arcgis-10.0 cursor
edited 9 mins ago
PolyGeo♦
53.9k1781246
53.9k1781246
asked 11 mins ago
Zhenyu YaoZhenyu Yao
112
112
To add a new row you need to be using an InsertCursor. If you are using ArcGIS Desktop 10.0 then you cannot be using arcpy.da because it did not exist until 10.1. What version are you using?
– PolyGeo♦
6 mins ago
add a comment |
To add a new row you need to be using an InsertCursor. If you are using ArcGIS Desktop 10.0 then you cannot be using arcpy.da because it did not exist until 10.1. What version are you using?
– PolyGeo♦
6 mins ago
To add a new row you need to be using an InsertCursor. If you are using ArcGIS Desktop 10.0 then you cannot be using arcpy.da because it did not exist until 10.1. What version are you using?
– PolyGeo♦
6 mins ago
To add a new row you need to be using an InsertCursor. If you are using ArcGIS Desktop 10.0 then you cannot be using arcpy.da because it did not exist until 10.1. What version are you using?
– PolyGeo♦
6 mins ago
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%2f318440%2fchecking-field-is-empty-and-then-adding-new-row-with-zeros%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%2f318440%2fchecking-field-is-empty-and-then-adding-new-row-with-zeros%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
To add a new row you need to be using an InsertCursor. If you are using ArcGIS Desktop 10.0 then you cannot be using arcpy.da because it did not exist until 10.1. What version are you using?
– PolyGeo♦
6 mins ago