Select to view content in your preferred language

ERROR 002717: Invalid Arcade expression, Arcade error: Index out of bounds

1389
1
Jump to solution
10-17-2022 05:55 PM
GraemeBrowning_Aurizon
Occasional Contributor II

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:

GraemeBrowning_Aurizon_0-1666053813645.png

 

 

 

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:

GraemeBrowning_Aurizon_1-1666054123886.png

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?

 

0 Kudos
1 Solution

Accepted Solutions
GraemeBrowning_Aurizon
Occasional Contributor II

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)

 

View solution in original post

0 Kudos
1 Reply
GraemeBrowning_Aurizon
Occasional Contributor II

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)

 

0 Kudos