I am trying to add an attribute rule to a file geodatabase that contains an LRS Dataset (created using ArcGIS Roads and Highways) which has routes (polylines) with measures. I am using ArcGIS Pro 3.0.2 and I get the error below from these parameters:
var arrName = split($feature.RouteName,'_');
return Number(arrName[1],'####KM') + (Geometry($feature).paths[-1][-1].m/10000)
ERROR 002717: Invalid Arcade expression, Arcade error: Index out of bounds, Script line: 2
The same code runs without a problem when I use it within the Calculate Field tool on the same data:
The same code gives the same error when I try to use it with Add Attribute Rule within an ArcPy/Python script.
The same code cannot be saved as an Attribute Rule when I try to add it manually using the Attribute Rules view.
The same code gives the same error when I try to use it with the Add Attribute Rule tool dialog against the same LRS Dataset loaded into an Enterprise Geodatabase (SQL Server).
The values in $feature.RouteName all conform to patterns like:
AA-TEST_0000KM
ZZ-TEST_0099KM
Is there an alternative Arcade syntax that I can try?
Solved! Go to Solution.
I was able to work around this by replacing my Arcade expression of:
var arrName = split($feature.RouteName,'_');
return Number(arrName[1],'####KM') + (Geometry($feature).paths[-1][-1].m/10000)
with another which returns the same expected result for my data of:
return Number(Mid($feature.RouteName,8,4)) + ($feature.END_M/10000)
I was able to work around this by replacing my Arcade expression of:
var arrName = split($feature.RouteName,'_');
return Number(arrName[1],'####KM') + (Geometry($feature).paths[-1][-1].m/10000)
with another which returns the same expected result for my data of:
return Number(Mid($feature.RouteName,8,4)) + ($feature.END_M/10000)