Select to view content in your preferred language

Field calculator code not working when using text field as a parameter

296
2
Jump to solution
10-04-2024 01:48 PM
TylerMorton
New Contributor

Hi everyone! I'm fairly new to using  the ArcGIS API for Python and Python in general. I'm trying to write a script to populate a "Client_Status" field based on my company's "Internal_Status" field. There are no errors popping up when I run this, however it is not actually updating any rows as shown in the screenshot below.

TylerMorton_0-1728074742591.png

I then tweaked the code and set the where clause equal to and OBJECTID, since that's the field that was used in all the ESRI documentation I saw, and it worked! So I'm guessing using the "Internal_Status" field in the where clause is what went wrong.

TylerMorton_1-1728074742593.png

However I really need this calculation to be based on the "Internal_Status" field, since these statuses are input from a list by field agents and I just need to convert them to the format/exact wording the client wants. Can anyone help with identifying what else might be wrong in the first screenshot? Does the calculate function only work with certain field types? If so, can someone point me in the direction of a workaround for this? Any guidance would be very appreciated!

 

0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor

You have single quotes around "Internal_Status". Remove them and it should work.

View solution in original post

2 Replies
KenBuja
MVP Esteemed Contributor

You have single quotes around "Internal_Status". Remove them and it should work.

TylerMorton
New Contributor

That worked thank you!!

0 Kudos