hello,
I am trying to use the SequentialNumber() for Calculate Field but I would like to calculate the Field based on the a field called SampleDate in ascending order.
I have tried using the helpers and modify the code block but failed.
i tried a arcade expression(below) but got null values as retuned values
// Arcade for SequentialNumber
var rec = 0;
function SequentialNumber() {
var pStart = 1;
var pInterval = 1;
var SampleDate = $feature.SampleDate; // Name of the field used for sorting
// Access the global feature set
var Opp_table = FeatureSetByName($datastore, 'SDEP.SDEADMIN.WaterSampleInspectionsOperator');
// Sort the features based on "SampleDate" field
var sortedFeatures = Sort(Opp_table, SampleDate, 'ASC');
if (rec == 0) {
rec = pStart;
} else {
rec = rec + pInterval;
}
// Assign the sequential number based on the sorted order
return rec;
}
Any help would be much appreciated