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
)
Solved! Go to Solution.
Expression HAS TO BE Arcade.
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.