"Copy to Python Window" script does not run

652
10
Jump to solution
11-27-2023 01:04 PM
drWood
by
New Contributor III

Could someone please provide some insight into why this script will not run? I want to format this script to run for all of the feature classes for our asset inventory, but the copied script from the geoprocessing history will not execute due to error shown in second picture, leaving me no choice but to manually format each execution in the geoprocessing pane.

 

Any help/direction would be much appreciated.

 

arcpy.management.AddAttributeRule(
    in_table="dHydraulicElevation",
    name="FacilityID",
    type="CALCULATION",
    script_expression=r'//Assign initial FacilityID value to variable FID;
var IdSeq = NextSequenceValue("heSeq1");
var FID = "HE_" + text(Date(), "MMDDYYYY_") + IdSeq;
//Test first sequence value
if(IdSeq<=999999){
   return FID} 
else {IdSeq = NextSequenceValue("heSeq2");
      FID = "HE_" + text(Date(), "MMDDYYYY_") + IdSeq};
//Test second sequence value if necessary;
if(IdSeq<=999999){
    return FID}
else {FID = "Update Attribute Rule";
return FID};',
    is_editable="EDITABLE",
    triggering_events="INSERT",
    error_number="",
    error_message="",
    description="",
    subtype="ALL",
    field="FacilityID",
    exclude_from_client_evaluation="EXCLUDE",
    batch="NOT_BATCH",
    severity=None,
    tags=None
)

drWood_1-1701119016721.png

 

0 Kudos
10 Replies
Brian_Wilson
Occasional Contributor III

Expression HAS TO BE Arcade.

Brian_Wilson_0-1701192889442.png

I'd love to be able to write Arcade code in VS Code, and test it, and maintain it using industry standard tools, like I do with Python and JavaScript.

Until that is possible, Arcade is just a bauble.

 

 

 

0 Kudos