0

I made a Join between a shape and a dbf, and now I want to calculate some data from the table that came as a result from that Join. Everytime I try to run the Field Calculator it says there's an error. I read I should re-save that table as a different shape so I can edit the attributes, but:

  1. I don't know if that correct and
  2. I don't know how to do that.

I've using ArcGIS for Desktop for a very short time.

  • 1
    Normally the complaint is that 'you need to be editing to calculate across an inner join' or something like that. If you right click on the layer and select Data::export data it will save with the join made into new fields... this may not be what you want. Consider importing the table into a geodatabase as it would be slightly more robust... however, if the join is based on the FID of the shapefile you've got real problems as FID values change when edited - let me know if this is the case and I can walk you through fixing it. – Michael Stimson Dec 10 '14 at 22:42
  • 1
    Would you be able to edit your question to include a picture of the Field Calculator with your values - make sure that they are easily readable, and also a copy/paste of the text in your error message, please? If you can also tell us the version of ArcGIS for Desktop you are using that may be significant for this question. There is an edit button beneath your question to let you revise it with these details. – PolyGeo Dec 10 '14 at 22:42
  • 1
    Also, what is the error message? For @Michael Miles-Stimson comment about FIDs, which is very valid, we've sometimes created another field, AltID, and calculated the FID or OBJECTID fields into that, since the new fields will remain static. This is not elegant, but we deal with the data we're given. – recurvata Dec 11 '14 at 0:12
  • 1
    I do the same @recurvata, except I call it bOID. This is the same persistent identifier throughout the life cycle of the feature whether it's shapefile, SDE or local geodatabase... we add it as soon as we get data so that we can relate all records back to the original delivery at any stage - then we have a script that removes the field prior to delivery. It works for us. – Michael Stimson Dec 11 '14 at 0:15
  • @Michael Miles-Stimson, adding it to all files is a very good idea. We've just been doing it to facilitate joins, but your idea of using it to track records is a great bonus. – recurvata Dec 11 '14 at 0:22
2

You do not have to resave the table with the Join in place if you used a standard join and have edit rights in the directory where the shapefile is stored. I assume you added a field to the shapefile and want to fill it in. Select the table field from the Field Calculator field list box to get the fully qualified name of the joined table field (i.e., [TableName.FieldName])

Have you set up a field of the correct type to receive the data from the joined table? If the table contains Text and the field you want to calculate permits Long values, an error will occur if any value in the table Text field is not a real number. Normally the two field types should match. If both fields are text fields, are you sure you allowed enough characters in the shapefile field to match the number of characters in the table? By default ArcMap will create a SHORT field, but that only works if all values coming from your table are real numbers in the numeric range that the short field allows.

If the field types match correctly, but you have records in the shapefile that are unmatched in the table, an error will occur when you try to use the Field Calculator to insert a Null value in those unmatched records. Geodatabase feature classes allow that, but for most field types shapefiles do not. Select all records where the TableName.FID > -1 to only select the features with a matching table record, then perform the calculation.

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.