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
Export your table to a gdb and run either the Field Calculator or the script on that exported table. If the errors persist, I'm absolutely out of ideas.
Good morning Johannes,
I am able to run the Arcade expression on the table Inside of the FGDB
My data does have identical values for the for the sample date
see below
Results after running the Calculation and sorting by Sample Date
It seems that the codeworks after the first identical values change, Then its picks up the next record count after the first set of identical records are ran through.
So in this example I had 4 records that matched the same sample date in ascending order ,
then it picked up the count of 5 after the first set of identical passed.
Getting closer to making this work.
Thank you Johannes for all of your help so far I would be lost with out it?
I also ran the Python to see what results I would get and received this
Again thank you for your support Sir.
Brian.
Is there a way to do this and have the numbering restart when a new date starts?