I'm getting a "Test execution error":
Test execution error: Execution error - Out of bounds. Verify test data
Ultimately this script will be used to parse down a field from the attribute table so I wrote it in the ArcGIS Arcade Playground to get a better handle on how to parse the text. Yes I know I have lots of calls to Console, this was me trying to figure out where the problem was occurring since error message was ever so helpful.
I turns out the error is being cause by what I think should be a simple variable assignment line.
When line 56 is commented out the script actually runs, albeit not the end result that I want.
On Line 55 I'm trying to assign the variable prefix a string that will be processed through the next iteration of the for loop that begins on line 31.
I still get the message even when Line 55 is commented out and I use Line 56 as a simple string.
var name = "12 45 78 01 34 6 IFD A"
var lenToIFD = Find(" IFD", name)
//var noIFDname = replace(name, " IFD","")
var noIFDname = left(name, lenToIFD)
var fullName = replace(name, "IFD", "\nInfrastructure\nFinancing\nDistrict")
var nameLen = count(name)
var arrayName = split(noIFDname, " ")
var maxLength = 14
var prefix = ""
var finalOutput = ""
var counter = 0
var prefixArray = []
var prefixArrayCounter = 0
Console(noIFDname)
console(prefix)
console(lenToIFD)
console(maxLength)
Console((arrayName))
Console("OOOOOOOOOOOOOOOOOOOOOO")
// determine district number from text at end of Plat Name
var distNum = right(name, nameLen - lenToIFD-4)
// Find text plat name before IFD
if (lenToIFD <= maxLength){
prefix = left(name,lenToIFD)
}
else{
for (var index in arrayName){
Console("============")
Console(index)
Console(counter)
Console((prefixArrayCounter))
Console(arrayName[index])
if (index == counter){
if (count(arrayName[index])<= maxLength){
Console("Begin While Loop")
Console(count(prefix))
while (count(prefix)< maxLength){
console(arrayName[counter])
prefix = prefix + " " + arrayName[counter]
counter = counter + 1
index = counter
Console(prefix)
}
Console("End While Loop")
Console(("XXXXXXXXXXXXXXXXX"))
console(arrayName[counter])
prefixArray[prefixArrayCounter] = replace(prefix," ","",false)
Console(prefixArray[prefixArrayCounter])
var newPrefix = replace(noIFDname, prefixArray[prefixArrayCounter],"")
prefix = newPrefix
//prefix = "QQQ"
Console("NewPrefix")
Console(newPrefix)
prefixArrayCounter = prefixArrayCounter +1
if (index <= counter){
Console("CONTINUE")
continue
}
}
}
else{
continue
}
var varTemp = replace(prefix," ","",false)
}
}
console(prefixArray)
finalOutput = varTemp +"\nInfrastructure\nFinancing District" + distNum
return(finalOutput)
What am I not seeing?
Thank you