How to combine search and update cursor on one table to change values [closed] The 2019 Stack Overflow Developer Survey Results Are In Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar ManaraDebugging ArcPy script to search, get value, compare to field names and sum field values?Creating a value-counting table with search- and update cursorArcPy Update Cursor after nested Search Cursor giving tuple assignment error?Error when updating arcpy.SearchCursor to arcpy.da.SearchCursorArcpy Search Cursor Looping through columns to search for specific valuesUsing dictionary and cursors to calculate a field based on values from another table - KeyError [0]Using two Search and Update cursor pairs on the same feature classCalculating field with ArcPy cursor?Search Cursor Return Field Name If All Rows Contain a ValueSwitching from Nested Search Cursors to Dictionaries

Does Parliament hold absolute power in the UK?

Circular reasoning in L'Hopital's rule

Can we generate random numbers using irrational numbers like π and e?

What do I do when my TA workload is more than expected?

Why can't wing-mounted spoilers be used to steepen approaches?

Why doesn't a hydraulic lever violate conservation of energy?

60's-70's movie: home appliances revolting against the owners

Using dividends to reduce short term capital gains?

Was credit for the black hole image misappropriated?

Is it ethical to upload a automatically generated paper to a non peer-reviewed site as part of a larger research?

For what reasons would an animal species NOT cross a *horizontal* land bridge?

Can each chord in a progression create its own key?

how can a perfect fourth interval be considered either consonant or dissonant?

should truth entail possible truth

What happens to a Warlock's expended Spell Slots when they gain a Level?

"is" operation returns false with ndarray.data attribute, even though two array objects have same id

Sub-subscripts in strings cause different spacings than subscripts

Keeping a retro style to sci-fi spaceships?

Loose spokes after only a few rides

Store Dynamic-accessible hidden metadata in a cell

Is there a way to generate uniformly distributed points on a sphere from a fixed amount of random real numbers per point?

ELI5: Why do they say that Israel would have been the fourth country to land a spacecraft on the Moon and why do they call it low cost?

Accepted by European university, rejected by all American ones I applied to? Possible reasons?

Presidential Pardon



How to combine search and update cursor on one table to change values [closed]



The 2019 Stack Overflow Developer Survey Results Are In
Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar ManaraDebugging ArcPy script to search, get value, compare to field names and sum field values?Creating a value-counting table with search- and update cursorArcPy Update Cursor after nested Search Cursor giving tuple assignment error?Error when updating arcpy.SearchCursor to arcpy.da.SearchCursorArcpy Search Cursor Looping through columns to search for specific valuesUsing dictionary and cursors to calculate a field based on values from another table - KeyError [0]Using two Search and Update cursor pairs on the same feature classCalculating field with ArcPy cursor?Search Cursor Return Field Name If All Rows Contain a ValueSwitching from Nested Search Cursors to Dictionaries



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I'm working a script for drives, I would like to read the values from the "Layer" field, if the values state "D-DRIVE-PAVE-P" then I want the field "SURFACEM" to be ANG if not then GR.



import arcpy, os

cursor = arcpy.da.SearchCursor(MyTable, ["D-DRIVE-PAVE-P"])
for row in cursor:
D-DRIVE-PAVE-P.add(row[0]

cursor = arcpy.da.UpdateCursor(MyTable, ["Layer", "SURFACEM"])
for row in cursor:
if row[0] in D-DRIVE-PAVE-P:
row[1] = "ANG"
else:
row[1] = "GR"
cursor.updateRow(row)
del cursor


This is what I have however I am receiving a syntax error with this line of coding.










share|improve this question









New contributor




T. Tobin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











closed as unclear what you're asking by PolyGeo♦ Apr 7 at 7:18


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.













  • 3





    Add the error message to your question. You are missing as cursor: at the searchcursor and the indentation after is incorrect. What is this supposed to do: D-DRIVE-PAVE-P.add(row[0]

    – BERA
    Apr 7 at 6:34












  • When you provide code, please make sure that it is the smallest code to exhibit the problem. You have dedicated ten-plus lines of the question to compiling a list which isn't used in the cursor blocks, and the cursor blocks themselves contain many syntax errors that prevent script execution (with usage, indentation, variable naming, open parenthesis), which really ought to be resolved before the question is asked.

    – Vince
    Apr 7 at 12:58






  • 2





    your search cursor is misused. Update cursor is enough in your case, either with your test or by first making a layer (makefeaturelayer) that only include the row matching a quesry

    – radouxju
    Apr 8 at 16:40

















0















I'm working a script for drives, I would like to read the values from the "Layer" field, if the values state "D-DRIVE-PAVE-P" then I want the field "SURFACEM" to be ANG if not then GR.



import arcpy, os

cursor = arcpy.da.SearchCursor(MyTable, ["D-DRIVE-PAVE-P"])
for row in cursor:
D-DRIVE-PAVE-P.add(row[0]

cursor = arcpy.da.UpdateCursor(MyTable, ["Layer", "SURFACEM"])
for row in cursor:
if row[0] in D-DRIVE-PAVE-P:
row[1] = "ANG"
else:
row[1] = "GR"
cursor.updateRow(row)
del cursor


This is what I have however I am receiving a syntax error with this line of coding.










share|improve this question









New contributor




T. Tobin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











closed as unclear what you're asking by PolyGeo♦ Apr 7 at 7:18


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.













  • 3





    Add the error message to your question. You are missing as cursor: at the searchcursor and the indentation after is incorrect. What is this supposed to do: D-DRIVE-PAVE-P.add(row[0]

    – BERA
    Apr 7 at 6:34












  • When you provide code, please make sure that it is the smallest code to exhibit the problem. You have dedicated ten-plus lines of the question to compiling a list which isn't used in the cursor blocks, and the cursor blocks themselves contain many syntax errors that prevent script execution (with usage, indentation, variable naming, open parenthesis), which really ought to be resolved before the question is asked.

    – Vince
    Apr 7 at 12:58






  • 2





    your search cursor is misused. Update cursor is enough in your case, either with your test or by first making a layer (makefeaturelayer) that only include the row matching a quesry

    – radouxju
    Apr 8 at 16:40













0












0








0








I'm working a script for drives, I would like to read the values from the "Layer" field, if the values state "D-DRIVE-PAVE-P" then I want the field "SURFACEM" to be ANG if not then GR.



import arcpy, os

cursor = arcpy.da.SearchCursor(MyTable, ["D-DRIVE-PAVE-P"])
for row in cursor:
D-DRIVE-PAVE-P.add(row[0]

cursor = arcpy.da.UpdateCursor(MyTable, ["Layer", "SURFACEM"])
for row in cursor:
if row[0] in D-DRIVE-PAVE-P:
row[1] = "ANG"
else:
row[1] = "GR"
cursor.updateRow(row)
del cursor


This is what I have however I am receiving a syntax error with this line of coding.










share|improve this question









New contributor




T. Tobin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I'm working a script for drives, I would like to read the values from the "Layer" field, if the values state "D-DRIVE-PAVE-P" then I want the field "SURFACEM" to be ANG if not then GR.



import arcpy, os

cursor = arcpy.da.SearchCursor(MyTable, ["D-DRIVE-PAVE-P"])
for row in cursor:
D-DRIVE-PAVE-P.add(row[0]

cursor = arcpy.da.UpdateCursor(MyTable, ["Layer", "SURFACEM"])
for row in cursor:
if row[0] in D-DRIVE-PAVE-P:
row[1] = "ANG"
else:
row[1] = "GR"
cursor.updateRow(row)
del cursor


This is what I have however I am receiving a syntax error with this line of coding.







arcpy






share|improve this question









New contributor




T. Tobin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




T. Tobin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited Apr 8 at 16:54







T. Tobin













New contributor




T. Tobin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Apr 7 at 5:19









T. TobinT. Tobin

11




11




New contributor




T. Tobin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





T. Tobin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






T. Tobin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




closed as unclear what you're asking by PolyGeo♦ Apr 7 at 7:18


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









closed as unclear what you're asking by PolyGeo♦ Apr 7 at 7:18


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









  • 3





    Add the error message to your question. You are missing as cursor: at the searchcursor and the indentation after is incorrect. What is this supposed to do: D-DRIVE-PAVE-P.add(row[0]

    – BERA
    Apr 7 at 6:34












  • When you provide code, please make sure that it is the smallest code to exhibit the problem. You have dedicated ten-plus lines of the question to compiling a list which isn't used in the cursor blocks, and the cursor blocks themselves contain many syntax errors that prevent script execution (with usage, indentation, variable naming, open parenthesis), which really ought to be resolved before the question is asked.

    – Vince
    Apr 7 at 12:58






  • 2





    your search cursor is misused. Update cursor is enough in your case, either with your test or by first making a layer (makefeaturelayer) that only include the row matching a quesry

    – radouxju
    Apr 8 at 16:40












  • 3





    Add the error message to your question. You are missing as cursor: at the searchcursor and the indentation after is incorrect. What is this supposed to do: D-DRIVE-PAVE-P.add(row[0]

    – BERA
    Apr 7 at 6:34












  • When you provide code, please make sure that it is the smallest code to exhibit the problem. You have dedicated ten-plus lines of the question to compiling a list which isn't used in the cursor blocks, and the cursor blocks themselves contain many syntax errors that prevent script execution (with usage, indentation, variable naming, open parenthesis), which really ought to be resolved before the question is asked.

    – Vince
    Apr 7 at 12:58






  • 2





    your search cursor is misused. Update cursor is enough in your case, either with your test or by first making a layer (makefeaturelayer) that only include the row matching a quesry

    – radouxju
    Apr 8 at 16:40







3




3





Add the error message to your question. You are missing as cursor: at the searchcursor and the indentation after is incorrect. What is this supposed to do: D-DRIVE-PAVE-P.add(row[0]

– BERA
Apr 7 at 6:34






Add the error message to your question. You are missing as cursor: at the searchcursor and the indentation after is incorrect. What is this supposed to do: D-DRIVE-PAVE-P.add(row[0]

– BERA
Apr 7 at 6:34














When you provide code, please make sure that it is the smallest code to exhibit the problem. You have dedicated ten-plus lines of the question to compiling a list which isn't used in the cursor blocks, and the cursor blocks themselves contain many syntax errors that prevent script execution (with usage, indentation, variable naming, open parenthesis), which really ought to be resolved before the question is asked.

– Vince
Apr 7 at 12:58





When you provide code, please make sure that it is the smallest code to exhibit the problem. You have dedicated ten-plus lines of the question to compiling a list which isn't used in the cursor blocks, and the cursor blocks themselves contain many syntax errors that prevent script execution (with usage, indentation, variable naming, open parenthesis), which really ought to be resolved before the question is asked.

– Vince
Apr 7 at 12:58




2




2





your search cursor is misused. Update cursor is enough in your case, either with your test or by first making a layer (makefeaturelayer) that only include the row matching a quesry

– radouxju
Apr 8 at 16:40





your search cursor is misused. Update cursor is enough in your case, either with your test or by first making a layer (makefeaturelayer) that only include the row matching a quesry

– radouxju
Apr 8 at 16:40










0






active

oldest

votes

















0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

Magento 1.9 observer on only new product added ( no updated product )Admin Create New Order ObserverObserver checkout_cart_product_add_after get product quantity in cartHow can I differentiate between product creation and saving existing products?How to get the original price Product SaveBeforeMagento Observer for Admin Sales order Address updateHow do i get quantity in a product_save_after event observer magento2?Using observer event to get updated customer infoSave product observer - detect availabilityEvent not triggered when new product added in admin : Magento 2magento 1.9 observer on quantity product change

Does an object always see its latest internal state irrespective of thread? The 2019 Stack Overflow Developer Survey Results Are InDoes a finally block always get executed in Java?Java: serial thread confinement questionJava difference between fixed threadpool and scheduled threadpoolJackrabbit and concurrent modificationHow to stop a Runnable scheduled for repeated execution after a certain number of executionsMultiple threads accessing inner classHow can a loop be completed by two thread? say loop from count=1 to count=4 by ist thread and count =5 to 8 by 2nd thread?If I keep a reference to a Runnable, when does the Thread it ran on get released?How to stop a schedule ScheduledExecutorServiceHow to implement a singleThreadedScheduledExcecutor in wildfly

Adding contour labels to SpatialLinesDataFrame or sf object? The Next CEO of Stack OverflowTearing of SpatialLinesDataFrame and problem with gClip functionAutomatically adjusting map labelsExtracting data.frame from simple features object in RR convert sf object back to SpatialPolygonsDataFrameSimplify polygons of sf objectlines of a SpatialLinesDataFrame corresponding to pointsCropping sf object in R?Pattern matching with grepl on SpatialPolygonsDataFrame object in RHow to create and empty SpatialLinesDataFrame in RWarning message in raster::rotate(): “this does not look like an appropriate object for this function”