Hello!
I have a code that works and that increments by 1 the last id of the same field.
if the "NewID" is 400, as soon as I add a new feature that code becomes 401 and so on.
the flow is this:
1. adds a new feature,
2. selects from a list the domain
and
3. the RefNumber is the result of the concatenation of the domain + the incremented ID calculated as below.
// Get the current feature's newID field value
var currentID = $feature.newID_web;
// Get the maximum value of the newID field from all features
var maxID = Max(FeatureSetByName($datastore, "Items", ["newID_web"]), "newID_web");
// If currentID is null, it means this feature needs a new ID
if (IsEmpty(currentID)) {
return maxID + 1;
}
// If currentID is already set, return the currentID
return currentID;
Now, I was asked to increment by domain, such as:
domain_w_001
domain_w_002
domain_t_001
domain_w_003
......
I got lost at this point.
Any idea on how to increment by domain?
Thanks!