Skip to main content
16 events
when toggle format what by license comment
Feb 22, 2016 at 6:48 history edited PolyGeo CC BY-SA 3.0
deleted 7 characters in body
Mar 24, 2014 at 13:31 comment added Tee Put the VB code into a new field but just ended up blank. I wouldn't rule out an issue with the source code.
Mar 21, 2014 at 21:21 comment added John Ok, I made an edit to my original answer that gives a VB solution as well. Try running that with the VB parser in field calculator. Again, I tried it with my data and it worked, so, in theory it should work with yours as well.... if it still doesn't work, I think there might be something else going on with your source data and I really wouldn't know what to suggest.
Mar 21, 2014 at 21:19 history edited John CC BY-SA 3.0
updating to make the solution work in a different language that hopefully works in the question asker's environment
Mar 21, 2014 at 20:09 comment added Tee No worries. Thank you for all your help though!!
Mar 21, 2014 at 19:58 comment added John I really don't know what would be causing that then. I got the same error as you when I tried running it against a popup field with multiple lines in it. But once I got rid of the multiple lines and brought it all onto one line, it worked fine with no errors in field calculator. So, I'm sorry I don't know what to say... I wish I could be of more help.
Mar 21, 2014 at 17:41 comment added Tee OK, so the VB calculation worked, but now getting the same error when trying to calculate a new field (tried both text field and short integer and both python codes). I am definitely inputting the second popupfield, so I don't know what the issue is.
Mar 21, 2014 at 15:34 comment added John Warning, the above VB calculation WILL REMOVE NEW LINES FROM THE POPUP FIELD. If you need to retain this, you will need to add a new text field of the same character length as your pop-up field and calculate it's contents using the above vb code instead of overwriting your existing popup field's contents. Then you would use this new field's resulting contents as the input for the python code in the answer above.
Mar 21, 2014 at 15:32 comment added John Ok, I think I nailed down the problem. It works fine in python directly, but after a bunch of research apparently it's a bug/issue in ArcGIS Desktop that the Calculate Field tool can not handle multi-line values in the python parser (though it's ok in the VB parser). So I tested it in ArcGIS and this works: in field calculator run Replace(Replace([PopupInfo],Chr(10),vbnullstring),Chr(13),vbnullstring) on the popup field (use your own field name inbetween the brackets. For this one set the parser to VB in field calculator. Then run the other code I provided above using python parser.
Mar 21, 2014 at 14:23 comment added Tee Set the field to text and still got the same error
Mar 21, 2014 at 14:19 comment added Tee And yes- I set the parser to python
Mar 21, 2014 at 14:19 comment added Tee I tried both a short integer and string field- should I try another type? I am thinking the benchmark number pop up field includes the entire phrase 'Benchmark: 100'... so both. I'll try a string field again...
Mar 21, 2014 at 14:17 comment added John Also, I'm guessing you did, but just double checking, did you set the parser to Python in the field calculator options or did you leave it as the default VB Script? It should only work as Python.
Mar 21, 2014 at 14:08 comment added John Ok, here would be something else to check then. What field type is the field you created that you are trying to calculate the benchmark value into? Also, are all of the benchmark values just numbers or do some of them include text as well? If the benchmark values include text and you're trying to put it in a short integer field, it's going to error out. Let me know.
Mar 21, 2014 at 12:56 comment added Tee I really appreciate the help but neither worked... Here is the error message for both codes: Solution This error code covers a number of Python errors: Example error 1: exceptions.TypeError: cannot concatenate 'str' and 'int' objects. The above is a Python-specific error. The calculation is attempting to add or concatenate a string and a number. Example error 2: Invalid field shape@distance The above is an error using the geometry object. The distance method is not a valid method of the geometry object.
Mar 20, 2014 at 22:19 history answered John CC BY-SA 3.0