Good Morning Ian,
I must be missing something. In figuring out why I have a syntax errors, what I have found is break is for a loop, and result in results.getOutput was not defined. If I take out the break and replace it with a print statement, it actually just flies right through and does everything and does not stop.
Here is what I got so far. Lines 15-23 are based on what you responded with. Suggestions?
import arcpy
scratchWorkspace = r'C:\GISScripts\Scratch\Scratch.gdb'
selectExport = r'C:\GISScripts\Scratch\ReversedGeoCoded.gdb\GeoConcernsV2'
missingAddresses = "Match_Address"
ci = "ConcernID"
sql = """{} is NULL AND {} is not NULL""".format(missingAddresses, ci)
arcpy.MakeFeatureLayer_management(selectExport, 'temp_Layer', sql)
result = arcpy.GetCount_management('temp_Layer')
if int(result.getOutput(0)) > 0:
pass
else:
print "Goodbye!"
arcpy.FeatureClassToFeatureClass_conversion(selectExport, scratchWorkspace, "NoAddresses", sql)
arcpy.ReverseGeocode_geocoding(in_features="C:/GISScripts/Scratch/Scratch.gdb/NoAddresses", in_address_locator="C:/GISScripts/Scratch/Scratch.gdb/NearestAddress", out_feature_class="C:/GISScripts/Scratch/Scratch.gdb/R1T", address_type="ADDRESS", search_distance="100 Meters")
arcpy.Delete_management(r'C:\GISScripts\Scratch\Scratch.gdb\NoAddresses')
del selectExport
workspace = r'C:\GISScripts\Scratch\ReversedGeoCoded.gdb'
edit = arcpy.da.Editor(workspace)
edit.startEditing(False, False)
edit.startOperation()
targetFeatures = r'C:\GISScripts\Scratch\ReversedGeoCoded.gdb\GeoConcernsV2'
joinFeatures = r'C:\GISScripts\Scratch\Scratch.gdb\R1T'
fieldmappings = arcpy.FieldMappings()
fieldmappings.addTable(targetFeatures)
fieldmappings.addTable(joinFeatures)
print "Fieldmapping created"
layerName1 = "joinedTJ_view"
layerName2 = "GREAddress_view"
print "Joining variables created"
arcpy.MakeFeatureLayer_management(joinFeatures, "joinedTJ_view")
arcpy.MakeFeatureLayer_management(targetFeatures, "GREAddress_view")
print "Made Layers"
arcpy.AddJoin_management("GREAddress_view", "ConcernID", "joinedTJ_view", "ConcernID", "KEEP_COMMON")
print [i.name for i in arcpy.ListFields('GREAddress_view')]
print "Joined Up Sir"
fieldName1 = u'GeoConcernsV2.Match_Address'
fieldName2 = u'R1T.REV_Street'
calcExpression ="!"+ fieldName2 +"!"
arcpy.CalculateField_management(layerName2, fieldName1, calcExpression, "PYTHON_9.3")
print "Field Calculation Done"
arcpy.RemoveJoin_management(layerName2,"R1T")
print "Removed Join"
arcpy.Delete_management(r'C:\GISScripts\Scratch\Scratch.gdb\R1T')
print "Feature class deleted"
edit.stopOperation()
edit.stopEditing(True)