Non-pk sequence from another table

When creating a new student in the “old” program, I do the following –

  1. Find the student’s home district record (district.student_id = student.student_id).
  2. Lock/load the district record.
  3. Grab the next student number (student.record_number = district.next_student_number).
  4. Increment the district.next_student_number field (district.next_student_number += 1).
  5. Save and unload the district record.

This is not the pk, but rather a separate number of a particular alphanumeric format (e.g., “xxxxxxx-xxxxx-xxxx”, where I am getting the middle xxxxx from the district).

I’m looking for the best way to do this in Servoy. Is it the same?

Users can edit the district records (for other fields). I have left auto-save on so that conceivably it could be subject to multiple saves by different users.

I see that there is a SQL create sequence command, but would I then need to create one of these for each of thousands of district records? And create/delete them as district records are created/deleted? Are database sequences accessed through the “db seq” or “db identity” in the Servoy field specifier? If so, I assume that there is no way to select the particular sequence name on a field value?

Thanks,
Don