I've discovered the problem is mis-matched field types (which is another issue altogether - they should be all the same!) My GIS field type is correct, the join DB field type is incorrect..... I'm not sure quite how to structure the code to do a conversion of the field value within the CalculateField tool. The code in the else statement works.
rows = arcpy.UpdateCursor(your arguments go here) for row in rows: new_value = float(row.DBfield) row.GISfield = new_value rows.updateRow(row)
for row in rows: new_value = row.DBfield row.GISfield = float(new_value) rows.updateRow(row)
for row in rows: row.GISfield = float(row.DBfield) rows.updateRow(row)
Is the NULL value within the feature class's numeric field, or the database table's numeric field? You can have NULL values within a feature class's numeric field as long as 'ALLOW NULL VALUES' is set to YES.
if LayerFieldType == "Double": arcpy.CalculateField_management(LayerName, FC + "." + gisField, float("!" + tableNameOutput + "." + dbField + "!"), "PYTHON", "") else: arcpy.CalculateField_management(LayerName, FC + "." + gisField, "[" + tableNameOutput + "." + dbField + "]", "VB", "")
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.