Hello. I am using the field calculator to multiply the value in the field "flash_area" by 0.15. I have attached a couple screenshots.
It works for about half of the entries but then it stops and I get error 000539 syntax error: invalid syntax. My field newArea is a float. I am using ArcMap 10.6.
Look at the values in flash_area; if it does some but not all, it's hitting a record with a value it can't handle. Check for <null> values. Something about object id 3139 is goofing on you. Create a copy and delete that record and run your calculation on the copy and see if / where it bails out. I just ran the value in a Spyder console and I got a return:
flasharea <SPAN class="operator token">=</SPAN> <SPAN class="number token">1000000000</SPAN> x <SPAN class="operator token">=</SPAN> flasharea<SPAN class="operator token">*</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="number token">15</SPAN> x <SPAN class="string token">''</SPAN>'<SPAN class="number token">150000000.0</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
I'm not sure if they will fix it soon. It is listed as "Medium" under "Severity." Apparently this has been a bug since version 10.5.
A bug with 'certain numbers'? Since 1990 or so I've been using ESRI products and just when I thought I'd heard it all.
Is there any chance they may fix that little problem?
You might be better off using an update cursor if calculating is problematic (at least for certain numbers, that just slays me...).
I brought this up to Esri and they said it's actually a bug with certain numbers (like 1000000000). I will try a workaround with the try/except block. Thanks.
BUG-000110899Synopsis: Populating the field using Python expression for a specific value returns an error in the field calculator.
Yes, for repetitive tasks, a script is the way to go. You may want to 'wrap' the calculation is a try/except block so you can gracefully exit out of it if there's an error. Calculate or update cursor would do the trick.
I made a copy and deleted that record. It worked after that.
I'm not really sure what was wrong with that record. I eventually want to create a script that will process this data. Each day I will have a new file with new data.
That is also a float. Thanks.
Andrew,
What is the data type on flash_area? Your script does not like the value 1000000000 in the first row with a NULL.
<SPAN class="" style="color: #990000; border: 0px; font-weight: inherit;"> </SPAN>
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.