2

I am trying to run the VBScript 'round' function using the field calculator on a column for a numeric field that contains a large number of rows (> 500k). When I run the code on a subset of the field (~100 rows), it runs perfectly fine, but when I try to run it on the entire table I get the subject error. It says 'there was an failure during processing, check the geoprocessing results window for details'. Does anyone know what could be causing this?

This is an annotation feature class that I would like to keep in the ArcMap environment while editing to avoid having to import it back.

my code is in the field calculator is: Round([TextString], 1)

The annotation feature class is currently in a file geodatabase for testing purposes and then I will run it in SDE, ArcMap 10.2.2, Sql-Server, Windows 7 64-bit SP1.

  • 3
    The Round() function takes a number as the expression but your field name suggests its a string, surprised it would even work? May be you should convert the field into a Double then do the rounding? – Hornbydd Aug 26 '15 at 13:56
  • When you run this on your 500K rows do you find that the rows at the start get updated, just not those at the end? If so, I think you should zero in on the first row that does not get updated and include the contents of that and a few preceding (working) and subsequent (not working) rows in your question. – PolyGeo Aug 27 '15 at 1:54
  • @Hornbydd I was still getting the same error when I created a floating field type and then ran the function so nothing changed with the field type. The workaround I did find though was once in was in the numeric field instead of string, I was able to just use the number format in the field properties menu to one decimal place. – Matt Aug 27 '15 at 13:12
  • I'm confused by your last comment. Perhaps you can turn it into a slightly expanded self-answer to let us know what you did to get past where you were stuck. – PolyGeo Aug 30 '15 at 23:06
0

I was never able to successfully run the Round() function using the field calculator on the entire data set. I continued to get the subject error every time, no matter what field type the values were in (string or float). What I did do was take the desired numeric values from the string field they were currently in and use the field calculator to put them a floating field type.

Once I had the desired values in the floating field, I was able to utilize the "number format" button in the field properties box. This option is very similar to Excel formatting and gave me the option of setting the rounding in the decimal places to tenths.

screen shot

0

I figured out eventually that I was getting this error because within the large annotation data set, there were characters that were not numbers (ex. ', !, #, etc.) and it was therefore throwing that error.

  • If you use the Python option in the FC, python has functions that can check if the value is numeric, e.g. isdigit(). You could use this to skip the non numeric values. VBS may have similar, don't recall. You could also use a try/catch block in Python, just use pass on the exception. One thing though - if your field contains values that aren't numbers, it can't be a numeric field. – recurvata Jan 15 '16 at 14:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.