I’m trying to duplicate the LO BASE “autovalue” functionality manually by creating a generator (sequence) and using a Before Insert trigger on a table to populate its ID (integer, not null) column. I was especially wondering if the manual method will result in BASE showing the column as “autovalue”, or can that only be achieved by making it that way explicitly only with BASE. Anyone know? Thx
Please when posting a question, provide your OS, the specific LO version you are using and for Base the database you are referring to (and connector type where applicable). Now you may have given this information in past questions but then one must search through those questions for information and it does not mean it is applicable to this question.
This can be answered in different ways depending upon the Firebird database being used - embedded or server.
There are two methods for creating an auto increment primary key field. For both methods see this post → How to create an auto-increment ID column in a Firebird embedded database table? Errors encountered..
If using the Trigger method, the
AutoValue area in a table edit is not seen. Also the value is not seen in a form or table view until it is refreshed. This occurs in both server and embedded.
If using the
identity method, for server it is the same as when using a Trigger. However, with embedded the
AutoValue in a table edit is seen and the value is immediately shown in a form or table view.
As with all questions, if this answers your question please tick the (upper left area of answer). It helps others to know there was an accepted answer.
I’m working with an embedded Firebird 3 database. I’ve verified that the trigger method works (yes, I noticed that records did not show up correctly [I also have two audit timestamp columns populated via triggers] until I exit and re-open the table view). Will try the Identity method, which seems much simpler and has the advantage of showing as Autovalue in LO BASE. Thanks!