Answer the question
In order to leave comments, you need to log in
Trigger implementation?
Hello. I decided to rewrite from the backend (Ruby) to the implementation in the database in order to optimize. The best way to do this functionality is automatic numbering. There is a table Institutions, which is a reference for all documents, this table has a field prefix: string{3}.
It is necessary that when creating a document, the last document with the filtering Institutions.id is taken and if the prefix does not change, then it is simply added to the numbering +1. For example, the last document is "PPR00011", then the next one will already be "PPR00012".
And if there are no documents, or the prefix has been changed ... then the numbering must start from the beginning. "PPR00001"
Thank you
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question