+ Reply to Thread
Results 1 to 50 of 50

Thread: Issue with Field Calculator

  1. #1
    Chadd Fuemmeler
    Join Date
    Aug 2010
    Posts
    3
    Points
    0
    Answers Provided
    0


    0

    Unhappy Issue with Field Calculator

    I am trying to populate a field with text using the field calculator. However, it will not populate the field with the string of text I enter. The process I used was this: I open the attribute table to the feature dataset and add a field. Next I run a field calculation of the new field and the equation used is CountyAbv="GE". After running the calculator the "Null" values in the new field remain.

    Note: I have tried to run the calculator both in and out of an edit session and I have installed the latest patches for ArcGIS 10 Also, I have tried using the equation CountyAbv=String("GE") with the same result.
    Thank you for checking into this. I hope we can resolve this issue.

  2. #2
    Amy Steiger
    Join Date
    Apr 2010
    Posts
    43
    Points
    0
    Answers Provided
    0


    0

    Default Re: Issue with Field Calculator

    Does it give you an error?

    With field calculator you should just be able to enter the text you wish to add to the fields in ""
    Check that the field you are trying to calculate is a Text field (default is a Short Integer field)

    I am assuming that your field is CountyAbv and the text you want to add is GE
    Because you have right clicked on the field you want to calculate in order to get to Field calculator, you don't need to enter the name of the field again, so all you will need to add into the Field Calculator box is:

    "GE"
    =-=-=-=-=-=-=-=
    Amy Steiger
    GIS Analyst
    Wollongong, Australia

  3. #3
    Jeff Van Etten
    Join Date
    Aug 2010
    Posts
    84
    Points
    3
    Answers Provided
    0


    0

    Default Re: Issue with Field Calculator

    As Amy suggests, sounds like the field type is something other than text. Try deleting the new column and add it again selecting text from the drop down menu.

    Good luck.

    Jeff
    Attached Thumbnails Attached Thumbnails Click image for larger version

Name:	add field.JPG‎
Views:	205
Size:	14.6 KB
ID:	2109  

  4. #4
    Chadd Fuemmeler
    Join Date
    Aug 2010
    Posts
    3
    Points
    0
    Answers Provided
    0


    0

    Default Re: Issue with Field Calculator

    Thank you for your the responses. Unfortunately, the field set up is not the problem. I've added it and deleted it several times and always change it from short integer to text. The problme is when the text is entered in it will not populate the fields. No error comes up when running the field calculator. The proffessor I'm working with has 15 years + experience with GIS sat with me and tried to do it himself. However, the process which worked in 9.3.1 is not working in 10. Perhaps that explains things a little better.

  5. #5
    Sean Summers
    Join Date
    Jul 2010
    Posts
    15
    Points
    0
    Answers Provided
    0


    0

    Default Re: Issue with Field Calculator

    Your field calculator should look like the attached image. Another thought is to make sure you have enough text spaces when you set up the field.
    Attached Thumbnails Attached Thumbnails Click image for larger version

Name:	FieldCalc.JPG‎
Views:	616
Size:	31.6 KB
ID:	2116  

  6. #6
    Chadd Fuemmeler
    Join Date
    Aug 2010
    Posts
    3
    Points
    0
    Answers Provided
    0


    0

    Default Re: Issue with Field Calculator

    Wow...thanks a lot. I have been working in a map document that now I believe might be corrupt. Everything is working fine. Thanks so much all!

  7. #7
    Jason Weis
    Join Date
    Jan 2010
    Posts
    23
    Points
    1
    Answers Provided
    0


    0

    Default Re: Issue with Field Calculator

    Another little "quirk" that I discovered with Field Calculator in version 10 - it seems to execute the first calculation that I perform, but then I need to save my edits before it will allow me to perform a second calculation. Otherwise, the "Null" values will remain.
    Jason Weis, PE
    GIS Manager
    OMNNI Associates, Inc.
    Appleton, Wisconsin

  8. #8
    Robert Hodges
    Join Date
    Nov 2009
    Posts
    50
    Points
    3
    Answers Provided
    0


    0

    Default Re: Issue with Field Calculator

    Quote Originally Posted by omnni View Post
    Another little "quirk" that I discovered with Field Calculator in version 10 - it seems to execute the first calculation that I perform, but then I need to save my edits before it will allow me to perform a second calculation. Otherwise, the "Null" values will remain.
    I've found the same problem. I'm wondering how many others run into this. It's ok when you have one or two fields to calculate, but when you are doing 15, it can get somewhat annoying.

  9. #9
    John DeMartino
    Join Date
    Aug 2010
    Posts
    8
    Points
    0
    Answers Provided
    0


    0

    Default Re: Issue with Field Calculator

    I've had problems with calculate in Arc10 as well. I noticed that it would only populate the value for SOME of the features if I'm in an edit session. If I am out of an edit session it appears to populate all the selected features.
    I think perhaps this was because the geodatabase I was working on was a 9.3 gdb and hadn't been upgraded. In fact, I couldn't even add a new field to one of my features until I upgraded the gdb.

  10. #10
    Lisa Goetsch
    Join Date
    Jun 2010
    Posts
    3
    Points
    0
    Answers Provided
    0


    0

    Default Re: Issue with Field Calculator

    I've found the same problem in ArcGIS 10 of having to save my edits before field calculator will work again.

    I also found that while editing I cannot change a group of features in the attributes window if one or more of the features already have the attribute that I want all off the selected features to have.

  11. #11
    Glenn Kammerer
    Join Date
    Jan 2010
    Posts
    46
    Points
    6
    Answers Provided
    0


    0

    Default Re: Issue with Field Calculator

    This has probably been the most frustrating thing about 10 that I've run across so far. I have tried everything to get field calculator to work, and it just doesn't. I have verified ad nausea that the field type and data types are the same and that the syntax is correct, and it just doesn't work. I am assuming that one is still allowed to right click on a field header, choose "Field Calculator..." and enter an expression OUTSIDE of an edit session and still be able to calculate the field. I've tried it in edit sessions, outside edit sessions, selecting all records, selecting some records, selecting no records. I'm not even getting an error, it just doesn't work.

    Attached are two screenshots to verify my process.

    Could there be a larger issue with MXD's becoming corrupt?
    Attached Thumbnails Attached Thumbnails Click image for larger version

Name:	Field Calc 1.JPG‎
Views:	251
Size:	135.5 KB
ID:	2145   Click image for larger version

Name:	Field Calc 2.JPG‎
Views:	251
Size:	34.7 KB
ID:	2146  

  12. #12
    Amy Steiger
    Join Date
    Apr 2010
    Posts
    43
    Points
    0
    Answers Provided
    0


    0

    Default Re: Issue with Field Calculator

    Quote Originally Posted by omnni View Post
    Another little "quirk" that I discovered with Field Calculator in version 10 - it seems to execute the first calculation that I perform, but then I need to save my edits before it will allow me to perform a second calculation. Otherwise, the "Null" values will remain.
    I have the noticed the same problem now - really annoying!
    =-=-=-=-=-=-=-=
    Amy Steiger
    GIS Analyst
    Wollongong, Australia

  13. #13
    Jeff Van Etten
    Join Date
    Aug 2010
    Posts
    84
    Points
    3
    Answers Provided
    0


    0

    Default Re: Issue with Field Calculator

    I have not experienced this problem at all yet and we use this on a daily basis. I also am just using shp files and file geodatabases. Wonder if that is an ArcGIS Server issue?

    What I have just noticed just now using the field calculator is that if you use the same text as your column heading, it automatically makes it Sentence case rather than lower case as typed in.

    i.e. if colum heading is "Test" and you used the field calculator to populate the with "test 1 2 3" the result is "Test 1 2 3". If I change this to "pest 1 2 3" the result is as expected "pest 1 2 3".

    See examples below!
    Attached Thumbnails Attached Thumbnails Click image for larger version

Name:	field properties.JPG‎
Views:	138
Size:	56.6 KB
ID:	2288   Click image for larger version

Name:	field calculator.JPG‎
Views:	161
Size:	70.4 KB
ID:	2289   Click image for larger version

Name:	table result.JPG‎
Views:	133
Size:	80.9 KB
ID:	2290  

  14. #14
    Kent Marten
    Join Date
    Oct 2009
    Posts
    95
    Points
    17
    Answers Provided
    0


    0

    Question Re: Issue with Field Calculator

    Quote Originally Posted by AmyN View Post
    I have the noticed the same problem now - really annoying!
    Amy, Glenn, Lisa, Robb,

    Have you reported this issue regarding consecutive field calculations in an edit session to Esri Technical Support?

    Can you please respond to this thread with some information for me:
    1. Operating System
    2. Datasource (FileGDB, Oracle SDE, ...)

    Thanks,

    Kent M.

  15. #15
    Robert Hodges
    Join Date
    Nov 2009
    Posts
    50
    Points
    3
    Answers Provided
    0


    0

    Default Re: Issue with Field Calculator

    Hi Kent,

    I have not reported this issue, but to answer your questions...

    1. Windows 7 Professional
    2. Personal Geodatabase

    Thanks,
    Robb

  16. #16
    Amy Steiger
    Join Date
    Apr 2010
    Posts
    43
    Points
    0
    Answers Provided
    0


    0

    Default Re: Issue with Field Calculator

    Quote Originally Posted by esrikmarten View Post
    Amy, Glenn, Lisa, Robb,

    Have you reported this issue regarding consecutive field calculations in an edit session to Esri Technical Support?

    Can you please respond to this thread with some information for me:
    1. Operating System
    2. Datasource (FileGDB, Oracle SDE, ...)

    Thanks,

    Kent M.
    Hi Kent,
    I have not reported it either.
    1. Windows XP Professional
    2. Personal GDB

    Cheers
    =-=-=-=-=-=-=-=
    Amy Steiger
    GIS Analyst
    Wollongong, Australia

  17. #17
    Lisa Goetsch
    Join Date
    Jun 2010
    Posts
    3
    Points
    0
    Answers Provided
    0


    0

    Default Re: Issue with Field Calculator

    Hi Kent,
    I have not reported it either.

    1. Windows Vista Ultimate
    2. Personal Geodatabase

    Thanks,
    Lisa

  18. #18
    Kent Marten
    Join Date
    Oct 2009
    Posts
    95
    Points
    17
    Answers Provided
    0


    0

    Default Re: Issue with Field Calculator

    Thank you for the feedback.
    I'm investigating the issue.

    Kent M.

  19. #19
    Brian Gallegos
    Join Date
    Apr 2010
    Posts
    4
    Points
    0
    Answers Provided
    0


    0

    Default Re: Issue with Field Calculator

    Quote Originally Posted by robb_hodges View Post
    I've found the same problem. I'm wondering how many others run into this. It's ok when you have one or two fields to calculate, but when you are doing 15, it can get somewhat annoying.
    Same problem here! Sad to see functionality going down. I know ESRI thought it was helping by incorporating Catalog into the ArcMap environment but to have simple functionality such as field calculator degraded, just isn't worth it!

  20. #20
    Brian Gallegos
    Join Date
    Apr 2010
    Posts
    4
    Points
    0
    Answers Provided
    0


    0

    Default Re: Issue with Field Calculator

    Quote Originally Posted by robb_hodges View Post
    Hi Kent,

    I have not reported this issue, but to answer your questions...

    1. Windows 7 Professional
    2. Personal Geodatabase

    Thanks,
    Robb
    Ditto on the operating system and .mdb

  21. #21
    Huw Greenhough
    Join Date
    Sep 2010
    Posts
    62
    Points
    5
    Answers Provided
    0


    0

    Default Re: Issue with Field Calculator

    I've just run into a possibly related issue. I ran Field Calculator on a couple of fields, one text, one numeric, & both times ArcGIS went throught the motions but didn't actually change the entries. I then realised I hadn't started an edit session. As soon as I did start an edit session the table entries all updated instantly (both columns at once) to the values I'd applied previously, without me running Field Calculator again!

    Another person in our office has experienced the same behaviour. Surely this can't be intended.

    Edit: I then stopped the edit session & was not asked if I wanted to save my edits! They just stayed updated. i.e. saved already.

    Win 7 Pro
    File Geodatabase

  22. #22
    Jay Cummins
    Join Date
    Apr 2010
    Posts
    15
    Points
    1
    Answers Provided
    0


    0

    Default Re: Issue with Field Calculator

    Same issue here: Windows XP SP3 with a personal geodatabase--no error, but the data is not updated. Once I saved, the field calculator worked...sort of: I was calculating a text field and some of the values had semi-colons. After the calculate, the semi-colons were gone.

  23. #23
    Jennifer Zumbado-Hannibal
    Join Date
    Oct 2010
    Posts
    4
    Points
    0
    Answers Provided
    0


    0

    Angry Re: Issue with Field Calculator

    I'm also having trouble calculating a string field. I had to go to 9.3.1 in order to do this simplest of things. I had over 200 records and I just wasn't going to do it one-by-one. This is very frustrating.

  24. #24
    Adam Hoole
    Join Date
    Oct 2010
    Posts
    1
    Points
    0
    Answers Provided
    0


    0

    Default Re: Issue with Field Calculator

    Hi all. Yes I (and a few other operators here) have found the same issue with Arc10's field calculator (ie issues with not being able to populate data into records with null values, and having to save one field edit before being able to undertake another).

    One thing we have noticed is that this seems to be more prevalent with personal geodatabases, whether they've been upgraded to Arc10 or not. When attempting calculations with file geodatabases or SDEs, this problem doesn't seem to occur for us. Might be worth converting pers. gdbases to file gdbases and see how you get on?

    We have reported the issues with ESRI Aus.

  25. #25
    Wolfgang Stemberger
    Join Date
    Jul 2010
    Posts
    3
    Points
    0
    Answers Provided
    0


    0

    Default Re: Issue with Field Calculator

    I ran into the same problem, however working with a shapefile. OS: Windows 7 64-bit Prof.

    Edit: I could solve the problem by selecting all entries and using the "calculate field"-tool from the toolbox
    (without selection it did not work).
    Last edited by c716524; 10-26-2010 at 01:08 AM.

  26. #26
    Huw Greenhough
    Join Date
    Sep 2010
    Posts
    62
    Points
    5
    Answers Provided
    0


    0

    Default Re: Issue with Field Calculator

    Applied SP1 yesterday. Just used Field Calculator outside an edit session & still it doesn't work properly - no visible changes to the table. As before, then start an edit session, & BANG!, the changes appear.

    Quote Originally Posted by Huwg View Post
    I've just run into a possibly related issue. I ran Field Calculator on a couple of fields, one text, one numeric, & both times ArcGIS went throught the motions but didn't actually change the entries. I then realised I hadn't started an edit session. As soon as I did start an edit session the table entries all updated instantly (both columns at once) to the values I'd applied previously, without me running Field Calculator again!

    Another person in our office has experienced the same behaviour. Surely this can't be intended.

    Edit: I then stopped the edit session & was not asked if I wanted to save my edits! They just stayed updated. i.e. saved already.

    Win 7 Pro
    File Geodatabase

  27. #27
    Kent Marten
    Join Date
    Oct 2009
    Posts
    95
    Points
    17
    Answers Provided
    0


    0

    Question Re: Issue with Field Calculator

    Huwg,

    Have you contacted Esri Technical Support about these issues?

    Regards,
    Kent M.

  28. #28
    Avram Sandor
    Join Date
    Nov 2010
    Posts
    2
    Points
    0
    Answers Provided
    0


    0

    Thumbs down Re: Issue with Field Calculator

    As somebody mentioned above the field calculator seems to be degraded. Calculated just the selected records is not working properly. It calculates the entire table (least for me).
    Overall I think this is the buggiest version you guys ever released (I’m using ESRI since the release of 3.1 and I didn’t missed a single version). Too bad of some of the nice improvements but I got tired of things not working properly - going back to 9.3.1 which is great release.

  29. #29
    John Sobetzer

    Join Date
    Apr 2010
    Posts
    1,006
    Points
    235
    Answers Provided
    24


    0

    Default Re: Issue with Field Calculator

    [QUOTE=jeffrey.vanetten;34373]

    What I have just noticed just now using the field calculator is that if you use the same text as your column heading, it automatically makes it Sentence case rather than lower case as typed in.

    i.e. if colum heading is "Test" and you used the field calculator to populate the with "test 1 2 3" the result is "Test 1 2 3". If I change this to "pest 1 2 3" the result is as expected "pest 1 2 3".

    Interesting. I've noticed the same thing in 10; it is not a problem in 9x. If I have a field called "PUBLIC" I cannot use the calculator to put "Public" in it directly, I have to use "Pub" & "lic", otherwise it will capitalize the word. I can manually enter Public and I can copy and paste Public, but the calculator can't enter it. Same for the reverse situation where Public is the field name and the value is supposed to be PUBLIC. SP1 didn't change things.

  30. #30
    Jason Yaich
    Join Date
    Nov 2010
    Posts
    5
    Points
    1
    Answers Provided
    0


    0

    Default Re: Issue with Field Calculator

    I have also run into this problem with Arc 10 - Service Pack 1. I imported some 9.3 models. All of the models worked perfectly in Arc 10 except for the ones that use the field calculator tool. I did not make any changes to the model, so I assume it is an Arc 10 - field calculator issue.

    Same operating system (Windows XP) and pc and MXD projects. I have not reported this to ESRI technical support yet. I am hoping the forum can help with this, but to date, have not seen anyone saying the problem has been fixed.

  31. #31
    Richard Fairhurst

    Join Date
    Apr 2010
    Posts
    2,158
    Points
    1367
    Answers Provided
    194


    0

    Default Re: Issue with Field Calculator

    Quote Originally Posted by jyaich View Post
    I have also run into this problem with Arc 10 - Service Pack 1. I imported some 9.3 models. All of the models worked perfectly in Arc 10 except for the ones that use the field calculator tool. I did not make any changes to the model, so I assume it is an Arc 10 - field calculator issue.

    Same operating system (Windows XP) and pc and MXD projects. I have not reported this to ESRI technical support yet. I am hoping the forum can help with this, but to date, have not seen anyone saying the problem has been fixed.
    Were your calculations beyond just simple field calculations, for example involving ArcObjects geometry manipulations or advanced VBA methods? Then you may have to rewrite the calculations to VB Script or Python compliant code. Vb Script is similar to VBA, but has a number of changes, such as Dim statements can no longer use the As keyword to specify a variable type (all variables are type Variant in VB Script), many VBA methods are not supported, and virtually all ArcObjects based code will not work. So if you post you VBA code, you may get either VB Script compliant changes that will work or Python compliant changes that will work. VBA is dead and will never be restored as a fix, so you have to make it compliant to these other languages from here on out.
    Last edited by rfairhur24; 11-23-2010 at 12:33 PM.

  32. #32
    Richard Fairhurst

    Join Date
    Apr 2010
    Posts
    2,158
    Points
    1367
    Answers Provided
    194


    0

    Default Re: Issue with Field Calculator

    Quote Originally Posted by jeffrey.vanetten View Post

    What I have just noticed just now using the field calculator is that if you use the same text as your column heading, it automatically makes it Sentence case rather than lower case as typed in.

    i.e. if colum heading is "Test" and you used the field calculator to populate the with "test 1 2 3" the result is "Test 1 2 3". If I change this to "pest 1 2 3" the result is as expected "pest 1 2 3".

    Interesting. I've noticed the same thing in 10; it is not a problem in 9x. If I have a field called "PUBLIC" I cannot use the calculator to put "Public" in it directly, I have to use "Pub" & "lic", otherwise it will capitalize the word. I can manually enter Public and I can copy and paste Public, but the calculator can't enter it. Same for the reverse situation where Public is the field name and the value is supposed to be PUBLIC. SP1 didn't change things.
    Clearly this is a parsiing logic error on the part of the programmer that rewrote the field calculator code. Most likely he somehow mixed the process of stripping out field delimiters and string delimiters and passed all parsed Strings that matched the FC field list to the field comparison subroutine. It is standard practice to match field names in a case insensitive manner and then standardize the case for the rest of the code. Unless the code kept separate Strings that mached the FC field list from actual delimited field names, they would pass through that matching subroutine (and apparently be altered to match the FC case to make the rest of the code easier for the programmer). Your fix of adding the & charater to break the field name apart is a clever work around for now and confirms to me that this is a parsing error. That error needs to be fixed by the programmer.
    Last edited by rfairhur24; 11-23-2010 at 12:57 PM.

  33. #33
    Huw Greenhough
    Join Date
    Sep 2010
    Posts
    62
    Points
    5
    Answers Provided
    0


    0

    Default Re: Issue with Field Calculator

    Quote Originally Posted by esrikmarten View Post
    Huwg,

    Have you contacted Esri Technical Support about these issues?

    Regards,
    Kent M.
    No, unfortunately not an option. After years of never needing it we dropped out support contract for the first time ever (financial reasons - we're a not-for-profit).

  34. #34
    Patrick Horton
    Join Date
    Apr 2010
    Posts
    5
    Points
    1
    Answers Provided
    0


    0

    Default Re: Issue with Field Calculator

    As somebody mentioned above the field calculator seems to be degraded. Calculated just the selected records is not working properly. It calculates the entire table (least for me).
    Overall I think this is the buggiest version you guys ever released (I’m using ESRI since the release of 3.1 and I didn’t missed a single version). Too bad of some of the nice improvements but I got tired of things not working properly - going back to 9.3.1 which is great release.

    avrams: i had the same issue and made one more step, converting the data set from a shapefile to a fc in a file gdb and i'm no longer experiencing the same problem.

  35. #35
    Roger Dunn
    Join Date
    Oct 2010
    Posts
    32
    Points
    1
    Answers Provided
    0


    0

    Default Re: Issue with Field Calculator

    Boy, have I had a terrible last few hours. We have a model that originated in 9.x, and then I upgraded it to 10. When I say that, I mean I upgraded the Field Calculations to use Python. Now, these calculations aren't all that hard. Some of them do parse, while others calculate straight values. But when I couldn't get the model to do the calculating, I tried to do it myself with the Field Calculator dialog. I was in an Edit session, had one record selected for testing, and the value I was putting in the field was 1 (in an Integer field). What was my surprise when the record didn't change! After thinking it was a Python problem or an ArcMap/Python communication problem, it turned out just to be ArcMap! How frustrating, when this functionality has been there and working since the first ArcViews!

    After reading the good suggestions on this thread, here's what worked for us. Oh, and by the way we're on 32-bit Windows Vista Ultimate SP 2 running ArcGIS 10 SP 1.

    First, we got out of our edit session, closed ArcMap, opened ArcCatalog, and upgraded our personal geodatabase to version 10. Then I compacted it. I opened up ArcMap, edited the model and ran it a few steps at a time, and all our field calculations worked as expected. Note that I wasn't in editing mode when I started the model.

    Anyway, whatever happened between 9.3 and 10 for field calculations sure doesn't seem good. I thought that maybe the table view wasn't visually updating, but when I would close and reopen the map I could see that the old values were still there. But after doing what I did above, it seems "fixed", though that's hardly the term I should apply to this.

    ESRI, please fix this. I'll log a support call later today or tomorrow.

  36. #36
    Josh Thompson
    Join Date
    Jul 2010
    Posts
    69
    Points
    21
    Answers Provided
    2


    0

    Default Re: Issue with Field Calculator

    I have also encountered the issue wherein when calculating a field, nothing happens. Generally, saving after each field calculation operation will allow the next field calculation to perform.

    In my case, I have noticed this problem when I have another table JOIN'd to my edit table. For anyone else encountering this issue, are you perhaps also using a JOIN to your edit table?

    I suspect that maybe using a JOIN is the soucre of this bug(?).

    Josh

  37. #37
    Andrea B, GISP
    Join Date
    Jul 2010
    Posts
    360
    Points
    7
    Answers Provided
    3


    0

    Exclamation Re: Issue with Field Calculator

    Quote Originally Posted by esrikmarten View Post
    Amy, Glenn, Lisa, Robb,

    Have you reported this issue regarding consecutive field calculations in an edit session to Esri Technical Support?

    Can you please respond to this thread with some information for me:
    1. Operating System
    2. Datasource (FileGDB, Oracle SDE, ...)

    Thanks,

    Kent M.
    Kent,

    Also having this very annoying problem. I'm using Windows 7 and personal geodatabase. Almost all of us are using an mdb. Service patch, anyone?
    Andrea B, GISP
    GIS Coordinator

  38. #38
    Zaheer Haider
    Join Date
    Apr 2010
    Posts
    13
    Points
    0
    Answers Provided
    0


    0

    Default Re: Issue with Field Calculator

    i have an issue of Field Calculator regarding to python script for field comparision
    def compare(Customer1,Customer2):
    if Customer1==Customer2:
    return "True"
    else:
    return "False"

    output = compare(!Customer1!,!Customer2!)

    any missing or what i type wrong scripting

  39. #39
    Harshal Shegokar
    Join Date
    Jan 2010
    Posts
    10
    Points
    0
    Answers Provided
    0


    0

    Default Re: Issue with Field Calculator

    Quote Originally Posted by wazee View Post
    i have an issue of Field Calculator regarding to python script for field comparision
    def compare(Customer1,Customer2):
    if Customer1==Customer2:
    return "True"
    else:
    return "False"

    output = compare(!Customer1!,!Customer2!)

    any missing or what i type wrong scripting
    Hi Zaheer,


    'Seems like an indentation issue. Please try this:
    'def compare(Customer1,Customer2):
    '<space>'if Customer1==Customer2:
    '<space><space>'return "True"
    '<space>'else:
    '<space><space>'return "False"
    '
    'output = compare(!Customer1!,!Customer2!)

    Regrads,
    Harshal
    Last edited by harshals; 05-05-2012 at 07:55 AM. Reason: spell check

  40. #40
    Zaheer Haider
    Join Date
    Apr 2010
    Posts
    13
    Points
    0
    Answers Provided
    0


    0

    Default Re: Issue with Field Calculator

    Thanx for reply

    Still not working i m really stuukkkkkkkkk i used file geodatabase and ARCGIS 10 SP3 With Win 7

    waiting reply
    Zaheer

  41. #41
    Zaheer Haider
    Join Date
    Apr 2010
    Posts
    13
    Points
    0
    Answers Provided
    0


    0

    Default Re: Issue with Field Calculator

    now working but only first condition perform then calculate True but else condition not performing. why???
    def compare(Customer1,Customer2):
    if Customer1==Customer2:
    F2 = "True"
    else:
    F2 ="False"
    return F2

  42. #42
    Marcin Gasior

    Join Date
    Oct 2010
    Posts
    450
    Points
    559
    Answers Provided
    91


    0

    Default Re: Issue with Field Calculator

    Try this:
    Pre-Logic Script Code:
    Code:
    def compare(Customer1,Customer2):
        if Customer1 == Customer2:
            return "True"
        else:
            return "False"
    NewField =
    Code:
    compare(!Customer1!,!Customer2!)
    Marcin Gąsior : GIS Analyst | Polish Academy of Sciences || GIS freelancer/consultant: e-mail

  43. #43
    Harshal Shegokar
    Join Date
    Jan 2010
    Posts
    10
    Points
    0
    Answers Provided
    0


    0

    Default Re: Issue with Field Calculator

    Quote Originally Posted by wazee View Post
    now working but only first condition perform then calculate True but else condition not performing. why???
    def compare(Customer1,Customer2):
    if Customer1==Customer2:
    F2 = "True"
    else:
    F2 ="False"
    return F2


    Hi Zaheer,

    Would it be possible to attach a video file and can you also test the same data on some other system having ArcGIS 10 installed, if not I can test that for you. You have also received a recent reply with the print screen, I hope this helps. As a workaround you can use vb parser for now:
    Parser - VB
    Expression-
    dim result
    if [Customer1]==[Customer2] then:
    result = "true"
    else:
    result = "false"
    return result

    CODE:
    result

    Regards,
    Harshal

    P.S- if, else and return has to be in the same indentation
    Last edited by harshals; 05-08-2012 at 10:47 AM.

  44. #44
    Zaheer Haider
    Join Date
    Apr 2010
    Posts
    13
    Points
    0
    Answers Provided
    0


    0

    Default Re: Issue with Field Calculator

    Thanx for reply

    i have solve problem but for null value, not return False condition why ???
    i Attached print screen

    regard
    Zaheer
    Attached Thumbnails Attached Thumbnails Click image for larger version

Name:	Condition.jpg‎
Views:	69
Size:	80.7 KB
ID:	14192  

  45. #45
    Marcin Gasior

    Join Date
    Oct 2010
    Posts
    450
    Points
    559
    Answers Provided
    91


    0

    Default Re: Issue with Field Calculator

    Quote Originally Posted by wazee View Post
    for null value, not return False condition why ???
    Comparisons with NULL always produce NULL. NULL indicates unknown value but it's not the same as 0 (zero).

    The workaround may be replacing NULLs with some known constant, eg. 0.
    Marcin Gąsior : GIS Analyst | Polish Academy of Sciences || GIS freelancer/consultant: e-mail

  46. #46
    carl townsend
    Join Date
    Aug 2012
    Posts
    11
    Points
    0
    Answers Provided
    0


    0

    Angry Re: Issue with Field Calculator

    Someone else here who has the same ^&&%$#@ problem! I cannot get the fields populated with text I want using the field calculator, a trivial operation using ArcMap 9.1 I'm using ArcMAp 10, service pack 5!!! on Windows 7.

    Incredibly frustrating. Along with *all the other* frustrating, time wasting introduced things in ArcMap 10.

    Poor show ESRI.

  47. #47
    Dennis Jarrard
    Join Date
    Jul 2011
    Posts
    88
    Points
    61
    Answers Provided
    7


    1

    Default Re: Issue with Field Calculator

    For those of you who were receiving the problem with the Field Calculator not working after running it the first time in the same edit session: this was reported as a bug specific to personal geodatabases, and it has reportedly been fixed as of 10.1.

    Regarding the field calculator not doing anything when you attempt to run it: there are a few things to consider that can contribute problems such as this.

    1) Corrupted Map Document: open a new map document, add the data, and perform the same calculation. Does it work? If so, then there is something specific to the map document you were formerly working in that was causing the problem.

    2) Corrupted Data: export the data to a different format (shapefile to feature class, feature class to shapefile) and then test. If it works, then there is either something wrong with the original data, or the environment (geodatabase) that it is stored in.

    3) Corrupted Template: ArcMap runs off of a template that essentially stores toolbar arrangements, customizations, and interface settings. If it gets corrupted, it can cause some quirky behavior. Close ArcMap and browse to C:\users\*user-name*\AppData\Roaming\ESRI\Desktop**\ArcMap and rename the Normal.mxt file to something else. Upon starting up again, ArcMap will create a new one and run off of it.

    If this doesn't work, I would go back and rename the entire ESRI folder in AppData\Roaming. Also open the registry editor, go HKCU\Software and rename the ESRI folder there as well. Upon starting up, both directories will be recreated from scratch. This is essentially a soft reset of the software.

    Ultimately, if you none of these things help, please contact Support so we can help to determine where the problem is and document any problems that we do find. Once you reach a resolution, post it back here so that we all can know the answer .

  48. #48
    Barry Guidry
    Join Date
    Jun 2010
    Posts
    215
    Points
    7
    Answers Provided
    1


    0

    Default Re: Issue with Field Calculator

    I have tried everything Dennis has suggested, though I don't have a path such as "C:\users\*username*\AppData\Roaming\ESRI\Desktop**\ArcMap ", but something like "C:\Documents and Settings\username\Application Data\ESRI\Desktop10.0\ArcMap".

    Running ArcGIS Desktop 10 SP5. I have tried deleting my toolbox, and Normal.mxt template, so that ArcGIS will re-create them, with no luck.

  49. #49
    Katharina Dubach
    Join Date
    Apr 2010
    Posts
    299
    Points
    12
    Answers Provided
    0


    0

    Default Re: Issue with Field Calculator

    Quote Originally Posted by Huwg View Post
    Applied SP1 yesterday. Just used Field Calculator outside an edit session & still it doesn't work properly - no visible changes to the table. As before, then start an edit session, & BANG!, the changes appear.
    I have no clue if this could be a related issue, but have you tried to close your (seemingly unchanged) attribute table and open it again without starting an edit session? What you describe sounds like Field Calculator does indeed make the changes but they're not shown, and once you force Arc to refresh the screen completely, the changes become visible.

    I've had this happen to me so many times when digitizing features (mostly in shapefiles) and entering their attributes, then saving, then some of the records would dissapear from the attribute table, but they'd reappear after closing and reopening the table. Never had issues related to field Calculator, though, but maybe this changes in Version 10.

    (I'm working on Windows XP Pro, Arc 9.3.1)
    Cheers,
    Kathi

    "Doesn't work" is not a problem description.

  50. #50
    Barry Guidry
    Join Date
    Jun 2010
    Posts
    215
    Points
    7
    Answers Provided
    1


    0

    Default Re: Issue with Field Calculator

    I submitted a Technical Support request.

    Ran the "Repair" option in ArcGIS 10 Desktop (Add/Remove Programs) installer > reboot > edited data in new (blank) map document > Field Calculator worked. Tried to edit the same data in a previously saved map document - Field Calculator didn't work. Repaired the saved map document with "C:\Program Files\ArcGIS\Desktop10.0\Tools\MXDDoctor.exe". Now Field Calculator is again working in the repaired map document :-)

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts