Closed mmfc closed 1 year ago
Hi Sorry for the late response, and sorry this code was made long ago... You might look at this code where the guessing is done: https://github.com/rappen/AutoNumManager/blob/master/AutoNumMgr.cs#L479-L529
Let me know if I have to fix this, or if you have any ideas of a solution! 🙏
No problem - I was more writing the issue so that others are aware than expecting a solution :)
Looking at your script, you sort by createdon - which would work in most cases, but I had followed your suggested trick to number existing records - which is where the issue has arisen as the new autonumbers weren't done in createdon order.
Depending on the format of the sequence number, it could be ordered alphabetically by the autonum attribute (which is how I found the largest one) - but I think that would fail where the format had a {RANDSTRING} portion before the {SEQ}?
So overall, the only way to fix it would be rather complicated/programmatically expensive (e.g. splitting the string to get only the sequence part, and then ordering based on that) and not worthwhile.
Appreciate the seed number guessing is probably not 100% accurate, however it seems way off - I just updated 3 tables with a new auto number, and used your trick with a separate entity to update the autonumbers, however when re-setting the seed to the next value (as I massively underestimated it initially), the ANM guessed value was about 50 - 500 records out.
Whereas when I sorted the autonumber column A-Z, it was clear there were higher numbers than the guess.
Example at the lower end A-Z sorted Auto num![image](https://user-images.githubusercontent.com/4928472/202694243-3e70c15c-1651-4bb0-9093-5df09e3b735f.png)
Autonum guess![image](https://user-images.githubusercontent.com/4928472/202694336-703f8879-44b2-4d5d-8fff-0e2d8e4260ec.png)
Example at the higher end A-Z sorted Auto num![image](https://user-images.githubusercontent.com/4928472/202695360-343a2a16-c5ec-4f64-9c52-c2d351bc10eb.png)
Autonum guess![image](https://user-images.githubusercontent.com/4928472/202694983-4c4985b6-f034-4577-a245-a699ddf91271.png)