Hello ESRI people,
I am wondering if a database sequence function is acceptable in a batch calculation.
I prepared a batch calculation of which a return is a text value that is concatenated with text values from another layer and also database sequence value. This arcade expression works ok if the database sequence function is not included but if it is included, it will get an error (The code can be verified but cannot save it and Red marker comes up). Confirmed that numbers of output text characters are less than the field length. I don't know if this is because of my code or limitation of the function.
Any advice is much appreciated.
My code:
var fsMAP = FeatureSetByName($datastore, "MAP_A", ["*"])
var fsMAPIntersect = Intersects(fsMAP, $feature)
var fsMAPFirst = First(fsMAPIntersect)
if (fsMAPFirst == null) return {"errormessage": "There is no intersection"}
else if ($feature.MapNumber == null)
return concatenate(["TTTTT", Left(fsMAPFirst.MAP_NO,5),Text(NextSequenceValue("test_seq"), "00000")])
else return $feature.MapNumber
First thing to look at is does the evaluating user have access to the sequence and has it been tested running by the schema owner?
Second, you mention you are using a calculation rule. Check:
When using sequences in the script expression, ensure that the Exclude from application evaluation option is set to true.
This mandatory, if set to false the rule will fail; may only relate to 'insert edit operation'. We've asked Esri to amend the dialog as there is no reason to allow an choice that will cause an error.
"Calculation attribute rule examples - Generate an ID by incrementing a sequence"
Hi Andrew, Thanks for your advice. Yes, I missed the description regarding the exclusion of the application evaluation.
I run batch calculation but unfortunately, I could not get the return value that I wanted from the above code of NextSequenceValue. "NaN" VALUE was returned and "MapNumber" field values of all the features were updated with this NaN value. I just wanted to update only features that originally have null values in "MapNumber" field.
Checked sequence name is correct and sequence was made in a filegeodatabase in my local drive.
I assume my code would have something wrong but have not been able to figure out a cause. Do you see any problem in my code?