AnsweredAssumed Answered

Check for Duplicate AssetID Values with Arcade

Question asked by bguerrero_gis on May 28, 2020
Latest reply on Jun 17, 2020 by rborchert



I have an Arcade rule that generates an assetid when a point is inserted. This code is generated by measuring and rounding the distance, in feet, of the inserted point feature from a fix reference point. The process could generate repeated assetids for point features that are located at the same distance from the reference point.


Therefore, I'm trying to compare the new assetid with the existing ones using 2 for loops, with the code shown below.

The code tries to compare the new assetid against all the existing (inner loop), if there is a duplicate then change the new assetid, compare again, and if there is no duplicate then exit the outer loop.


The rule is not work. It never enters the if statement inside the inner loop, see code below. I purposely created duplicate assetids, as you can see in the pic below. Tried adding a point and saving the edit, then adding another one and saving again, in case the Arcade rule was not seeing the repeated assetid until the edits have been saved; but that didn't work.


Is there something wrong on the code or there is a better and more efficient way to do this?