Using 'if' function to set field value based on various other field values gives ERROR 999999?Error 999999...
Boss asked me to sign a resignation paper without a date on it along with my new contract
Why is it that Bernie Sanders always called a "socialist"?
Is Screenshot Time-tracking Common?
Can someone explain European graduate programs in STEM fields?
Is GMW different from Secret Sharing?
Is there a Tezos equivalent of ERC?
Did ancient Germans take pride in leaving the land untouched?
What is an efficient way to digitize a family photo collection?
How can changes in personality/values of a person who turned into a vampire be explained?
Why is Shelob considered evil?
How can I give a Ranger advantage on a check due to Favored Enemy without spoiling the story for the player?
Integer but not Laurent sequences
Including proofs of known theorems in master's thesis
Can an attached stirge deal no more than 10 HP of damage before it detaches?
When does a person lose diplomatic status?
How do I make my single-minded character more interested in the main story?
Are positive and negative energy from their respective planes inherently good and evil?
How can I differentiate duration vs starting time
Crack the bank account's password!
How bad is a Computer Science course that doesn't teach Design Patterns?
Do the speed limit reductions due to pollution also apply to electric cars in France?
What is formjacking?
Why don't you get burned by the wood benches in a sauna?
Is Developer Console going to be deprecated?
Using 'if' function to set field value based on various other field values gives ERROR 999999?
Error 999999 when using .isalnum in ArcGIS field calculator?Using ListFields and CalculateField to find max value in variable number of fields to populate another field?How to programmatically determine whether a spatial reference factory code is valid?Using ArcPy to set field values for all features within each polygon of separate feature class?Trying to modify records from one shapefile to another gives Error 999999?ArcGIS 10.1 arcpy Update Cursor is returning a list instead of a rowDebugging ArcPy script to search, get value, compare to field names and sum field values?Error 999999 when converting a point feature class to a raster in pythonArcPy - error with updateRow() using UpdateCursorGetting 999999 error from ArcPy script to increment one field when another field contains 0?
I am trying to populate a field with a value from another field in the same row, the condition I have set for this to take place is if a third field is equal to 0. In order to achieve this I have written a python script utilizing an 'if' statement and the getValue and setValue functions. I haven't used these functions before and I am having difficulty getting them to work properly. I tried various different lines of syntax but keep getting the same error:
Runtime error : ERROR 999999: Error executing function.
This has left me a little baffled as I am not sure where the problem lies. Anyway, here's the script:
import arcpy
joinFC = "C:MyArcGISLink_toolJoin22.shp"
rows = arcpy.UpdateCursor(joinFC)
for row in rows:
if row.getValue("Input") == 0:
edrn_value = row.getValue("LCC_DRN_3")
row.setValue("DRN_input", edrn_value)
rows.updateRow(row)
del row, rows
In case it is not obvious I am using ArcGIS 10.0. The field types for the three fields are:
LCC_DRN_3 = String
Input = Long
DRN_input = String
Does anyone have any idea why this script is not working?
arcpy arcgis-10.0 cursor error-999999
|
show 1 more comment
I am trying to populate a field with a value from another field in the same row, the condition I have set for this to take place is if a third field is equal to 0. In order to achieve this I have written a python script utilizing an 'if' statement and the getValue and setValue functions. I haven't used these functions before and I am having difficulty getting them to work properly. I tried various different lines of syntax but keep getting the same error:
Runtime error : ERROR 999999: Error executing function.
This has left me a little baffled as I am not sure where the problem lies. Anyway, here's the script:
import arcpy
joinFC = "C:MyArcGISLink_toolJoin22.shp"
rows = arcpy.UpdateCursor(joinFC)
for row in rows:
if row.getValue("Input") == 0:
edrn_value = row.getValue("LCC_DRN_3")
row.setValue("DRN_input", edrn_value)
rows.updateRow(row)
del row, rows
In case it is not obvious I am using ArcGIS 10.0. The field types for the three fields are:
LCC_DRN_3 = String
Input = Long
DRN_input = String
Does anyone have any idea why this script is not working?
arcpy arcgis-10.0 cursor error-999999
1
Can you edit your post to include the field types for each of the 3 fields?
– Paul
Jul 29 '14 at 15:30
1
what is "edrn_value"? Also I believe this could be achieved in python via the field calculator, is there a reason you're using a standalones script?
– GISKid
Jul 29 '14 at 15:31
1
Syntactically it should work, so make sure that those are the actual names of the field and not aliases, no locks on the shapefile, etc.
– Paul
Jul 29 '14 at 15:51
Thanks for your suggestions Paul. I'm pretty sure the field names are correct. There is one lock file on the shapefile though, but I'm assuming that is always there when you have the shapefile open.
– Geord359
Jul 29 '14 at 16:09
1
Are you able to print edrn_value? Are you able to set the value of DRN_input to any other string of your choice?
– Sleep6
Jul 29 '14 at 18:21
|
show 1 more comment
I am trying to populate a field with a value from another field in the same row, the condition I have set for this to take place is if a third field is equal to 0. In order to achieve this I have written a python script utilizing an 'if' statement and the getValue and setValue functions. I haven't used these functions before and I am having difficulty getting them to work properly. I tried various different lines of syntax but keep getting the same error:
Runtime error : ERROR 999999: Error executing function.
This has left me a little baffled as I am not sure where the problem lies. Anyway, here's the script:
import arcpy
joinFC = "C:MyArcGISLink_toolJoin22.shp"
rows = arcpy.UpdateCursor(joinFC)
for row in rows:
if row.getValue("Input") == 0:
edrn_value = row.getValue("LCC_DRN_3")
row.setValue("DRN_input", edrn_value)
rows.updateRow(row)
del row, rows
In case it is not obvious I am using ArcGIS 10.0. The field types for the three fields are:
LCC_DRN_3 = String
Input = Long
DRN_input = String
Does anyone have any idea why this script is not working?
arcpy arcgis-10.0 cursor error-999999
I am trying to populate a field with a value from another field in the same row, the condition I have set for this to take place is if a third field is equal to 0. In order to achieve this I have written a python script utilizing an 'if' statement and the getValue and setValue functions. I haven't used these functions before and I am having difficulty getting them to work properly. I tried various different lines of syntax but keep getting the same error:
Runtime error : ERROR 999999: Error executing function.
This has left me a little baffled as I am not sure where the problem lies. Anyway, here's the script:
import arcpy
joinFC = "C:MyArcGISLink_toolJoin22.shp"
rows = arcpy.UpdateCursor(joinFC)
for row in rows:
if row.getValue("Input") == 0:
edrn_value = row.getValue("LCC_DRN_3")
row.setValue("DRN_input", edrn_value)
rows.updateRow(row)
del row, rows
In case it is not obvious I am using ArcGIS 10.0. The field types for the three fields are:
LCC_DRN_3 = String
Input = Long
DRN_input = String
Does anyone have any idea why this script is not working?
arcpy arcgis-10.0 cursor error-999999
arcpy arcgis-10.0 cursor error-999999
edited 6 mins ago
PolyGeo♦
53.5k1780240
53.5k1780240
asked Jul 29 '14 at 15:23
Geord359Geord359
178117
178117
1
Can you edit your post to include the field types for each of the 3 fields?
– Paul
Jul 29 '14 at 15:30
1
what is "edrn_value"? Also I believe this could be achieved in python via the field calculator, is there a reason you're using a standalones script?
– GISKid
Jul 29 '14 at 15:31
1
Syntactically it should work, so make sure that those are the actual names of the field and not aliases, no locks on the shapefile, etc.
– Paul
Jul 29 '14 at 15:51
Thanks for your suggestions Paul. I'm pretty sure the field names are correct. There is one lock file on the shapefile though, but I'm assuming that is always there when you have the shapefile open.
– Geord359
Jul 29 '14 at 16:09
1
Are you able to print edrn_value? Are you able to set the value of DRN_input to any other string of your choice?
– Sleep6
Jul 29 '14 at 18:21
|
show 1 more comment
1
Can you edit your post to include the field types for each of the 3 fields?
– Paul
Jul 29 '14 at 15:30
1
what is "edrn_value"? Also I believe this could be achieved in python via the field calculator, is there a reason you're using a standalones script?
– GISKid
Jul 29 '14 at 15:31
1
Syntactically it should work, so make sure that those are the actual names of the field and not aliases, no locks on the shapefile, etc.
– Paul
Jul 29 '14 at 15:51
Thanks for your suggestions Paul. I'm pretty sure the field names are correct. There is one lock file on the shapefile though, but I'm assuming that is always there when you have the shapefile open.
– Geord359
Jul 29 '14 at 16:09
1
Are you able to print edrn_value? Are you able to set the value of DRN_input to any other string of your choice?
– Sleep6
Jul 29 '14 at 18:21
1
1
Can you edit your post to include the field types for each of the 3 fields?
– Paul
Jul 29 '14 at 15:30
Can you edit your post to include the field types for each of the 3 fields?
– Paul
Jul 29 '14 at 15:30
1
1
what is "edrn_value"? Also I believe this could be achieved in python via the field calculator, is there a reason you're using a standalones script?
– GISKid
Jul 29 '14 at 15:31
what is "edrn_value"? Also I believe this could be achieved in python via the field calculator, is there a reason you're using a standalones script?
– GISKid
Jul 29 '14 at 15:31
1
1
Syntactically it should work, so make sure that those are the actual names of the field and not aliases, no locks on the shapefile, etc.
– Paul
Jul 29 '14 at 15:51
Syntactically it should work, so make sure that those are the actual names of the field and not aliases, no locks on the shapefile, etc.
– Paul
Jul 29 '14 at 15:51
Thanks for your suggestions Paul. I'm pretty sure the field names are correct. There is one lock file on the shapefile though, but I'm assuming that is always there when you have the shapefile open.
– Geord359
Jul 29 '14 at 16:09
Thanks for your suggestions Paul. I'm pretty sure the field names are correct. There is one lock file on the shapefile though, but I'm assuming that is always there when you have the shapefile open.
– Geord359
Jul 29 '14 at 16:09
1
1
Are you able to print edrn_value? Are you able to set the value of DRN_input to any other string of your choice?
– Sleep6
Jul 29 '14 at 18:21
Are you able to print edrn_value? Are you able to set the value of DRN_input to any other string of your choice?
– Sleep6
Jul 29 '14 at 18:21
|
show 1 more comment
2 Answers
2
active
oldest
votes
Try this
from arcpy import env
d=joinFC.Describe
env.extent=d.extent
Strange but true, if your shapefile is outside processing extent, field calculator will fail on simplest tasks, that have nothing to do with shape field
add a comment |
It turns out that the error 999999 was a result of the field I was trying to extract a value from. The attribute table I was working with was the result of a spatial join and the field I used to join the tables was called LCC_DRN_ID. Because you cannot have two identically named fields in the same table the joined features LCC_DRN_ID field became LCC_DRN_3. For whatever reason ArcGIS did not like me using this field, so when I copied the contents of the LCC_DRN_3 field into a newly added field (DRN_update) the following script worked (thanks to Sleep6 for pointing me in the right direction):
import arcpy
joinFC = "C:MyArcGISLink_toolJoin22.shp"
rows = arcpy.UpdateCursor(joinFC)
for row in rows:
if row.getValue("Input") == 0:
edrn_value = row.getValue("DRN_update")
row.setValue("DRN_input", edrn_value)
rows.updateRow(row)
del row, rows
Guess I'll have to work an Add Field tool into my overall script!
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
});
}
});
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%2f108780%2fusing-if-function-to-set-field-value-based-on-various-other-field-values-gives%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try this
from arcpy import env
d=joinFC.Describe
env.extent=d.extent
Strange but true, if your shapefile is outside processing extent, field calculator will fail on simplest tasks, that have nothing to do with shape field
add a comment |
Try this
from arcpy import env
d=joinFC.Describe
env.extent=d.extent
Strange but true, if your shapefile is outside processing extent, field calculator will fail on simplest tasks, that have nothing to do with shape field
add a comment |
Try this
from arcpy import env
d=joinFC.Describe
env.extent=d.extent
Strange but true, if your shapefile is outside processing extent, field calculator will fail on simplest tasks, that have nothing to do with shape field
Try this
from arcpy import env
d=joinFC.Describe
env.extent=d.extent
Strange but true, if your shapefile is outside processing extent, field calculator will fail on simplest tasks, that have nothing to do with shape field
answered Jul 29 '14 at 22:06
FelixIPFelixIP
16.3k11642
16.3k11642
add a comment |
add a comment |
It turns out that the error 999999 was a result of the field I was trying to extract a value from. The attribute table I was working with was the result of a spatial join and the field I used to join the tables was called LCC_DRN_ID. Because you cannot have two identically named fields in the same table the joined features LCC_DRN_ID field became LCC_DRN_3. For whatever reason ArcGIS did not like me using this field, so when I copied the contents of the LCC_DRN_3 field into a newly added field (DRN_update) the following script worked (thanks to Sleep6 for pointing me in the right direction):
import arcpy
joinFC = "C:MyArcGISLink_toolJoin22.shp"
rows = arcpy.UpdateCursor(joinFC)
for row in rows:
if row.getValue("Input") == 0:
edrn_value = row.getValue("DRN_update")
row.setValue("DRN_input", edrn_value)
rows.updateRow(row)
del row, rows
Guess I'll have to work an Add Field tool into my overall script!
add a comment |
It turns out that the error 999999 was a result of the field I was trying to extract a value from. The attribute table I was working with was the result of a spatial join and the field I used to join the tables was called LCC_DRN_ID. Because you cannot have two identically named fields in the same table the joined features LCC_DRN_ID field became LCC_DRN_3. For whatever reason ArcGIS did not like me using this field, so when I copied the contents of the LCC_DRN_3 field into a newly added field (DRN_update) the following script worked (thanks to Sleep6 for pointing me in the right direction):
import arcpy
joinFC = "C:MyArcGISLink_toolJoin22.shp"
rows = arcpy.UpdateCursor(joinFC)
for row in rows:
if row.getValue("Input") == 0:
edrn_value = row.getValue("DRN_update")
row.setValue("DRN_input", edrn_value)
rows.updateRow(row)
del row, rows
Guess I'll have to work an Add Field tool into my overall script!
add a comment |
It turns out that the error 999999 was a result of the field I was trying to extract a value from. The attribute table I was working with was the result of a spatial join and the field I used to join the tables was called LCC_DRN_ID. Because you cannot have two identically named fields in the same table the joined features LCC_DRN_ID field became LCC_DRN_3. For whatever reason ArcGIS did not like me using this field, so when I copied the contents of the LCC_DRN_3 field into a newly added field (DRN_update) the following script worked (thanks to Sleep6 for pointing me in the right direction):
import arcpy
joinFC = "C:MyArcGISLink_toolJoin22.shp"
rows = arcpy.UpdateCursor(joinFC)
for row in rows:
if row.getValue("Input") == 0:
edrn_value = row.getValue("DRN_update")
row.setValue("DRN_input", edrn_value)
rows.updateRow(row)
del row, rows
Guess I'll have to work an Add Field tool into my overall script!
It turns out that the error 999999 was a result of the field I was trying to extract a value from. The attribute table I was working with was the result of a spatial join and the field I used to join the tables was called LCC_DRN_ID. Because you cannot have two identically named fields in the same table the joined features LCC_DRN_ID field became LCC_DRN_3. For whatever reason ArcGIS did not like me using this field, so when I copied the contents of the LCC_DRN_3 field into a newly added field (DRN_update) the following script worked (thanks to Sleep6 for pointing me in the right direction):
import arcpy
joinFC = "C:MyArcGISLink_toolJoin22.shp"
rows = arcpy.UpdateCursor(joinFC)
for row in rows:
if row.getValue("Input") == 0:
edrn_value = row.getValue("DRN_update")
row.setValue("DRN_input", edrn_value)
rows.updateRow(row)
del row, rows
Guess I'll have to work an Add Field tool into my overall script!
answered Jul 30 '14 at 9:27
Geord359Geord359
178117
178117
add a comment |
add a comment |
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%2f108780%2fusing-if-function-to-set-field-value-based-on-various-other-field-values-gives%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
1
Can you edit your post to include the field types for each of the 3 fields?
– Paul
Jul 29 '14 at 15:30
1
what is "edrn_value"? Also I believe this could be achieved in python via the field calculator, is there a reason you're using a standalones script?
– GISKid
Jul 29 '14 at 15:31
1
Syntactically it should work, so make sure that those are the actual names of the field and not aliases, no locks on the shapefile, etc.
– Paul
Jul 29 '14 at 15:51
Thanks for your suggestions Paul. I'm pretty sure the field names are correct. There is one lock file on the shapefile though, but I'm assuming that is always there when you have the shapefile open.
– Geord359
Jul 29 '14 at 16:09
1
Are you able to print edrn_value? Are you able to set the value of DRN_input to any other string of your choice?
– Sleep6
Jul 29 '14 at 18:21