A relative beginner here in Arcade, as well as to posting questions on forums, but I can't find a solution for this particular issue...
I'm working in ArcPro, attempting to build a table using the Insert Table Attribute/Dynamic Text Element with a custom Arcade expression (Arcade being the only choice available). My first task is to remove or reduce duplicate Project_IDs that are paired with associated Site_IDs. Being familiar with Javascript, I tried several methods such as reduce() and forEach(), but kept ending up with the same error:
'Invalid expression. Error on line 6. Close parenthesis expected'
There are no syntax errors detected using VS Code, etc. And yet I'm at a loss...
Here's the code as it is now:
var pID = [$feature.PROJECT_ID];
function removeDuplicates(pID) {
var unique = [];
for(i=0; i < pID.length; i++){
if(unique.indexOf((pID[i]) === -1)){
unique.push(pID[i])
}
}
return unique;
}
return removeDuplicates(pID);