Hello,
I would like to understand the best way to implement a unique identifier column in a Backendless table that follows a specific format. For example, I want the identifier to be structured as “year-sequence number” (e.g., 2024-00001).
Thank you for your assistance!
Regards,
Manuel
Hello @Manuel_Germano,
You can use Event Handlers (Before Create) for this:
which will trigger when a new record is created, and you can generate a unique ID based on, for example, the previous value of an AUTO NUMBER (AUTO INCREMENT) column.
Regards,
Alexander
Great!
Thank you @Alexander_Pavelko.
Regards,
Manuel
Hello again,
I’ve been exploring the “generated column” feature and have encountered a couple of limitations:
- Generated columns cannot reference an auto-increment field.
- Generated columns don’t appear to allow dynamic functions, such as checking the maximum value of a specific column.
Could you confirm if this is indeed the case? I’m considering whether this can be a viable alternative to using event handlers for my use case.
Thank you!
Regards,
Manuel
Hello, @Manuel_Germano.
Due to the fact that we have some restrictions on the use of generated column. The only alternative is event handlers.
Regards, Nikita.
OK.
Thank you @Nikita_Fedorishchev
Regards,
Manuel