Ryan,
Did you ever find a solution to your question? Which option did you choose?
What's wrong with Spatial Join?
Darren,
In my workflow option 3 might be a better an option. Spatial Join produces a whole new feature class as an output, instead of transferring an attribute from a selected polygon to the point features within the selected polygon. Thoughts?
Oh I see. It probably depends somewhat on the size of the datasets. Suppose there are 1000 points. You could do 1000 individual selections/field calculations, or 1 spatial join (to an in-memory feature class if you don't want to keep it) then 1 join then 1 field calculation. I'm guessing the second option is faster, but haven't tested.
I know I am not an efficient python scripter, so bear with me. I have attempted to script it with spatial join. The goal is to calculate the zone of a concern for only the ones that the zone field is null. Both feature classes are in an enterprise environment (the concerns and the zones). Here is what I have so far from testing on a file geodatabase. I am not sure it is joining properly and the field calculator dies. Any suggestions?
<SPAN class="comment token"># import modules</SPAN> <SPAN class="keyword token">import</SPAN> arcpy <SPAN class="comment token"># Set workspaces</SPAN> workspace <SPAN class="operator token">=</SPAN> r<SPAN class="string token">'C:\ESRITest\GeoReportingSystem\Testing9116\Testing9116.gdb'</SPAN> outWorkspace <SPAN class="operator token">=</SPAN> r<SPAN class="string token">'C:\ESRITest\GeoReportingSystem\Testing9116\Scratch.gdb'</SPAN> targetFeatures <SPAN class="operator token">=</SPAN> r<SPAN class="string token">'C:\ESRITest\GeoReportingSystem\Testing9116\Testing9116.gdb\GeoReporting'</SPAN> joinFeatures <SPAN class="operator token">=</SPAN> r<SPAN class="string token">'C:\ESRITest\GeoReportingSystem\Testing9116\Testing9116.gdb\GRSAldermanic'</SPAN> outfc <SPAN class="operator token">=</SPAN> r<SPAN class="string token">'C:\ESRITest\GeoReportingSystem\Testing9116\Scratch.gdb\AldermanicSJ'</SPAN> fieldmappings <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>FieldMappings<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> fieldmappings<SPAN class="punctuation token">.</SPAN>addTable<SPAN class="punctuation token">(</SPAN>targetFeatures<SPAN class="punctuation token">)</SPAN> fieldmappings<SPAN class="punctuation token">.</SPAN>addTable<SPAN class="punctuation token">(</SPAN>joinFeatures<SPAN class="punctuation token">)</SPAN> <SPAN class="comment token"># Replace a layer/table view name with a path to a dataset (which can be a layer file) or create the layer/table view within the script</SPAN> <SPAN class="comment token"># The following inputs are layers or table views: "GeoReporting Features", "GRSAldermanic"</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>SpatialJoin_analysis<SPAN class="punctuation token">(</SPAN>target_features<SPAN class="operator token">=</SPAN>targetFeatures<SPAN class="punctuation token">,</SPAN> join_features<SPAN class="operator token">=</SPAN>joinFeatures<SPAN class="punctuation token">,</SPAN> out_feature_class<SPAN class="operator token">=</SPAN>outfc<SPAN class="punctuation token">,</SPAN> join_operation<SPAN class="operator token">=</SPAN><SPAN class="string token">"JOIN_ONE_TO_ONE"</SPAN><SPAN class="punctuation token">,</SPAN> join_type<SPAN class="operator token">=</SPAN><SPAN class="string token">"KEEP_COMMON"</SPAN><SPAN class="punctuation token">,</SPAN> field_mapping<SPAN class="operator token">=</SPAN>fieldmappings<SPAN class="punctuation token">,</SPAN> match_option<SPAN class="operator token">=</SPAN><SPAN class="string token">"INTERSECT"</SPAN><SPAN class="punctuation token">,</SPAN> search_radius<SPAN class="operator token">=</SPAN><SPAN class="string token">""</SPAN><SPAN class="punctuation token">,</SPAN> distance_field_name<SPAN class="operator token">=</SPAN><SPAN class="string token">""</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">print</SPAN> <SPAN class="string token">"Done with Spatial Join"</SPAN> <SPAN class="comment token"># Replace a layer/table view name with a path to a dataset (which can be a layer file) or create the layer/table view within the script</SPAN> <SPAN class="comment token"># The following inputs are layers or table views: "AldermanicSJ"</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>DeleteField_management<SPAN class="punctuation token">(</SPAN>in_table<SPAN class="operator token">=</SPAN>outfc<SPAN class="punctuation token">,</SPAN> drop_field<SPAN class="operator token">=</SPAN><SPAN class="string token">"SpecificConcern;DescriptionOfConcern;ReportingEmail;DateClosed;ConcernStatus;PriorityLevel;PrimaryDepartment;PrimaryContact;PrimaryInformation;DeptLogging;ReportingMethod;FollowUpRequest;FollowUpContactInfo;AldermanicDistrict;ApproriateYN;NUMVOTES;DaysToClose;Match_Addr;Loc_Name;created_user;created_date;last_edited_user;last_edited_date;Address;Visibility;Report_ID;DISTRICTID"</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">print</SPAN> <SPAN class="string token">"Done with Deleting Fields"</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>MakeFeatureLayer_management<SPAN class="punctuation token">(</SPAN>outfc<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"outfc_view"</SPAN><SPAN class="punctuation token">)</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>MakeFeatureLayer_management<SPAN class="punctuation token">(</SPAN>targetFeatures<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"GRE_view"</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="comment token"># arcpy.MakeFeatureLayer_management(targetFeatures, "GRE_view")</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>AddJoin_management<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"GRE_view"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"ConcernID"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"outfc_view"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"ConcernID"</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">print</SPAN> <SPAN class="string token">"Joined Up Sir"</SPAN> fieldName1 <SPAN class="operator token">=</SPAN> <SPAN class="string token">"GRE_view.AldermanicDistrict"</SPAN> fieldName2 <SPAN class="operator token">=</SPAN> <SPAN class="string token">"!outfc_view.NAME!"</SPAN> <SPAN class="comment token"># Replace a layer/table view name with a path to a dataset (which can be a layer file) or create the layer/table view within the script</SPAN> <SPAN class="comment token"># The following inputs are layers or table views: "GeoReporting Features"</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>CalculateField_management<SPAN class="punctuation token">(</SPAN>in_table<SPAN class="operator token">=</SPAN>targetFeatures<SPAN class="punctuation token">,</SPAN> field<SPAN class="operator token">=</SPAN>fieldName1<SPAN class="punctuation token">,</SPAN> expression<SPAN class="operator token">=</SPAN>fieldName2<SPAN class="punctuation token">,</SPAN> expression_type<SPAN class="operator token">=</SPAN><SPAN class="string token">"PYTHON"</SPAN><SPAN class="punctuation token">,</SPAN> code_block<SPAN class="operator token">=</SPAN><SPAN class="string token">""</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">print</SPAN> <SPAN class="string token">"Field Calculation Done"</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>RemoveJoin_management<SPAN class="punctuation token">(</SPAN>in_layer_or_view<SPAN class="operator token">=</SPAN>targetFeatures<SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">print</SPAN> <SPAN class="string token">"Removed Join"</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>DeleteFeatures_management<SPAN class="punctuation token">(</SPAN>outfc<SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">print</SPAN> <SPAN class="string token">"Spatial Join feature class deleted"</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Perhaps try expression_type="PYTHON_9.3". If that doesn't work, can you provide the error message?
ExecuteError: Failed to execute. Parameters are not valid.
Error 000728: Field GRE_view.AldermanicDistrict does not exist within table
Failed to to execute (CalculateField).
Have you tried running through the workflow manually to see exactly what's going on? You could also verify the field names like:
<SPAN class="keyword token">print</SPAN> <SPAN class="punctuation token">[</SPAN>i<SPAN class="punctuation token">.</SPAN>name <SPAN class="keyword token">for</SPAN> i <SPAN class="keyword token">in</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>ListFields<SPAN class="punctuation token">(</SPAN><SPAN class="string token">'GRE_view'</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN></SPAN>
I am not quite sure what you mean by manual approach, but I have tried running things individually via arcmap, and each step of the script by itself. The only thing that does not "work" is the field calculate. I get a 000539 error Invalid field. Below is updated code. Thoughts?
<SPAN class="comment token"># import modules</SPAN> <SPAN class="keyword token">import</SPAN> arcpy <SPAN class="comment token"># Set workspaces</SPAN> workspace <SPAN class="operator token">=</SPAN> r<SPAN class="string token">'C:\ESRITest\GeoReportingSystem\Testing9116\Testing9116.gdb'</SPAN> outWorkspace <SPAN class="operator token">=</SPAN> r<SPAN class="string token">'C:\ESRITest\GeoReportingSystem\Testing9116\Scratch.gdb'</SPAN> targetFeatures <SPAN class="operator token">=</SPAN> r<SPAN class="string token">'C:\ESRITest\GeoReportingSystem\Testing9116\Testing9116.gdb\GeoReporting'</SPAN> joinFeatures <SPAN class="operator token">=</SPAN> r<SPAN class="string token">'C:\ESRITest\GeoReportingSystem\Testing9116\Testing9116.gdb\GRSAldermanic'</SPAN> outfc <SPAN class="operator token">=</SPAN> r<SPAN class="string token">'C:\ESRITest\GeoReportingSystem\Testing9116\Scratch.gdb\AldermanicSJ'</SPAN> fieldmappings <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>FieldMappings<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN> fieldmappings<SPAN class="punctuation token">.</SPAN>addTable<SPAN class="punctuation token">(</SPAN>targetFeatures<SPAN class="punctuation token">)</SPAN> fieldmappings<SPAN class="punctuation token">.</SPAN>addTable<SPAN class="punctuation token">(</SPAN>joinFeatures<SPAN class="punctuation token">)</SPAN> <SPAN class="comment token"># Replace a layer/table view name with a path to a dataset (which can be a layer file) or create the layer/table view within the script</SPAN> <SPAN class="comment token"># The following inputs are layers or table views: "GeoReporting Features", "GRSAldermanic"</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>SpatialJoin_analysis<SPAN class="punctuation token">(</SPAN>target_features<SPAN class="operator token">=</SPAN>targetFeatures<SPAN class="punctuation token">,</SPAN> join_features<SPAN class="operator token">=</SPAN>joinFeatures<SPAN class="punctuation token">,</SPAN> out_feature_class<SPAN class="operator token">=</SPAN>outfc<SPAN class="punctuation token">,</SPAN> join_operation<SPAN class="operator token">=</SPAN><SPAN class="string token">"JOIN_ONE_TO_ONE"</SPAN><SPAN class="punctuation token">,</SPAN> join_type<SPAN class="operator token">=</SPAN><SPAN class="string token">"KEEP_COMMON"</SPAN><SPAN class="punctuation token">,</SPAN> field_mapping<SPAN class="operator token">=</SPAN>fieldmappings<SPAN class="punctuation token">,</SPAN> match_option<SPAN class="operator token">=</SPAN><SPAN class="string token">"INTERSECT"</SPAN><SPAN class="punctuation token">,</SPAN> search_radius<SPAN class="operator token">=</SPAN><SPAN class="string token">""</SPAN><SPAN class="punctuation token">,</SPAN> distance_field_name<SPAN class="operator token">=</SPAN><SPAN class="string token">""</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">print</SPAN> <SPAN class="string token">"Done with Spatial Join"</SPAN> <SPAN class="comment token"># Replace a layer/table view name with a path to a dataset (which can be a layer file) or create the layer/table view within the script</SPAN> <SPAN class="comment token"># The following inputs are layers or table views: "AldermanicSJ"</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>DeleteField_management<SPAN class="punctuation token">(</SPAN>in_table<SPAN class="operator token">=</SPAN>outfc<SPAN class="punctuation token">,</SPAN> drop_field<SPAN class="operator token">=</SPAN><SPAN class="string token">"SpecificConcern;DescriptionOfConcern;ReportingEmail;DateClosed;ConcernStatus;PriorityLevel;PrimaryDepartment;PrimaryContact;PrimaryInformation;DeptLogging;ReportingMethod;FollowUpRequest;FollowUpContactInfo;AldermanicDistrict;ApproriateYN;NUMVOTES;DaysToClose;Match_Addr;Loc_Name;created_user;created_date;last_edited_user;last_edited_date;Address;Visibility;Report_ID;DISTRICTID"</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">print</SPAN> <SPAN class="string token">"Done with Deleting Fields"</SPAN> layerName1 <SPAN class="operator token">=</SPAN> <SPAN class="string token">"outfc_view"</SPAN> layerName2 <SPAN class="operator token">=</SPAN> <SPAN class="string token">"GRE_view"</SPAN> <SPAN class="comment token">#calcExpression ="!AldermanicSJ.NAME!"</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>MakeFeatureLayer_management<SPAN class="punctuation token">(</SPAN>outfc<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"outfc_view"</SPAN><SPAN class="punctuation token">)</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>MakeFeatureLayer_management<SPAN class="punctuation token">(</SPAN>targetFeatures<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"GRE_view"</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="comment token"># arcpy.MakeFeatureLayer_management(targetFeatures, "GRE_view")</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>AddJoin_management<SPAN class="punctuation token">(</SPAN><SPAN class="string token">"GRE_view"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"ConcernID"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"outfc_view"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"ConcernID"</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">print</SPAN> <SPAN class="punctuation token">[</SPAN>i<SPAN class="punctuation token">.</SPAN>name <SPAN class="keyword token">for</SPAN> i <SPAN class="keyword token">in</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>ListFields<SPAN class="punctuation token">(</SPAN><SPAN class="string token">'GRE_view'</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="keyword token">print</SPAN> <SPAN class="string token">"Joined Up Sir"</SPAN> fieldName1 <SPAN class="operator token">=</SPAN> <SPAN class="string token">"AldermanicDistrict"</SPAN> fieldName2 <SPAN class="operator token">=</SPAN> <SPAN class="string token">'AldermanicSJ.NAME'</SPAN> calcExpression <SPAN class="operator token">=</SPAN><SPAN class="string token">"!"</SPAN><SPAN class="operator token">+</SPAN>fieldName2<SPAN class="operator token">+</SPAN><SPAN class="string token">"!"</SPAN> <SPAN class="comment token"># Replace a layer/table view name with a path to a dataset (which can be a layer file) or create the layer/table view within the script</SPAN> <SPAN class="comment token"># The following inputs are layers or table views: "GeoReporting Features"</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>CalculateField_management<SPAN class="punctuation token">(</SPAN>targetFeatures<SPAN class="punctuation token">,</SPAN> fieldName1<SPAN class="punctuation token">,</SPAN> calcExpression<SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"PYTHON"</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="comment token">#print "Field Calculation Done"</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>RemoveJoin_management<SPAN class="punctuation token">(</SPAN>layerName2<SPAN class="punctuation token">,</SPAN><SPAN class="string token">"AldermanicSJ"</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">print</SPAN> <SPAN class="string token">"Removed Join"</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>Delete_management<SPAN class="punctuation token">(</SPAN>r<SPAN class="string token">'C:\ESRITest\GeoReportingSystem\Testing9116\Scratch.gdb\AldermanicSJ'</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">print</SPAN> <SPAN class="string token">"Spatial Join feature class deleted"</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
I should also add that when I did the line:
<SPAN class="" style="color: #0077aa; border: 0px; font-weight: inherit;">print</SPAN> <SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;">[</SPAN>i<SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;">.</SPAN>name <SPAN class="" style="color: #0077aa; border: 0px; font-weight: inherit;">for</SPAN> i <SPAN class="" style="color: #0077aa; border: 0px; font-weight: inherit;">in</SPAN> arcpy<SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;">.</SPAN>ListFields<SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;">(</SPAN><SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;">'GRE_view'</SPAN><SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;">)</SPAN><SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;">] </SPAN>
It showed me:
[u'GeoReporting.OBJECTID', u'GeoReporting.ConcernID', u'GeoReporting.GeneralConcern', u'GeoReporting.SpecificConcern', u'GeoReporting.DescriptionOfConcern', u'GeoReporting.ReportingEmail', u'GeoReporting.DateClosed', u'GeoReporting.ConcernStatus', u'GeoReporting.PriorityLevel', u'GeoReporting.PrimaryDepartment', u'GeoReporting.PrimaryContact', u'GeoReporting.PrimaryInformation', u'GeoReporting.DeptLogging', u'GeoReporting.ReportingMethod', u'GeoReporting.FollowUpRequest', u'GeoReporting.FollowUpContactInfo', u'GeoReporting.AldermanicDistrict', u'GeoReporting.ApproriateYN', u'GeoReporting.NUMVOTES', u'GeoReporting.DaysToClose', u'GeoReporting.GlobalID', u'GeoReporting.Match_Addr', u'GeoReporting.Loc_Name', u'GeoReporting.SHAPE', u'GeoReporting.created_user', u'GeoReporting.created_date', u'GeoReporting.last_edited_user', u'GeoReporting.last_edited_date', u'GeoReporting.Address', u'GeoReporting.Visibility', u'GeoReporting.Report_ID', u'AldermanicSJ.OBJECTID', u'AldermanicSJ.Join_Count', u'AldermanicSJ.TARGET_FID', u'AldermanicSJ.ConcernID', u'AldermanicSJ.GeneralConcern', u'AldermanicSJ.NAME']
I have tried various combinations of u'AldermanicSJ.NAME', but get that 000539 error
This would be my guess:
fieldName1 <SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.498039); border: 0px; font-weight: inherit; font-size: 14px;">=</SPAN> <SPAN class="" style="color: #669900; border: 0px; font-weight: inherit; font-size: 14px;">"<SPAN style="color: #3d3d3d; background-color: #ffffff;">GeoReporting.AldermanicDistrict</SPAN>"</SPAN> fieldName2 <SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.498039); border: 0px; font-weight: inherit; font-size: 14px;">=</SPAN> <SPAN style="color: #3d3d3d; background-color: #ffffff;">'AldermanicSJ.NAME'</SPAN> calcExpression <SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.498039); border: 0px; font-weight: inherit; font-size: 14px;">=</SPAN><SPAN class="" style="color: #669900; border: 0px; font-weight: inherit; font-size: 14px;">"!"</SPAN><SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.498039); border: 0px; font-weight: inherit; font-size: 14px;">+</SPAN>fieldName2<SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.498039); border: 0px; font-weight: inherit; font-size: 14px;">+</SPAN><SPAN class="" style="color: #669900; border: 0px; font-weight: inherit; font-size: 14px;">"!"</SPAN> <SPAN class="" style="color: slategray; border: 0px; font-weight: inherit; font-size: 14px;"># Replace a layer/table view name with a path to a dataset (which can be a layer file) or create the layer/table view within the script</SPAN> <SPAN class="" style="color: slategray; border: 0px; font-weight: inherit; font-size: 14px;"># The following inputs are layers or table views: "GeoReporting Features"</SPAN> arcpy<SPAN class="" style="color: #999999; border: 0px; font-weight: inherit; font-size: 14px;">.</SPAN>CalculateField_management<SPAN class="" style="color: #999999; border: 0px; font-weight: inherit; font-size: 14px;">(</SPAN>targetFeatures<SPAN class="" style="color: #999999; border: 0px; font-weight: inherit; font-size: 14px;">,</SPAN> fieldName1<SPAN class="" style="color: #999999; border: 0px; font-weight: inherit; font-size: 14px;">,</SPAN> calcExpression<SPAN class="" style="color: #999999; border: 0px; font-weight: inherit; font-size: 14px;">,</SPAN> <SPAN class="" style="color: #669900; border: 0px; font-weight: inherit; font-size: 14px;">"PYTHON"</SPAN><SPAN class="" style="color: #999999; border: 0px; font-weight: inherit; font-size: 14px;">)</SPAN>
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.