Hello my friends,
Thanks for the inspiration.
The answer from Craig, looks to me a good idea how i can do it.
many thanks,
Bart
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
-
The following is something that I have used in MySQL.
MySQL statement:
CREATE TABLE IF NOT EXISTS autonumbering
( Year char(4) not null default '',
Type varchar(10) not null default '',
IDint(11) not null auto_increment,
Notes varchar(64) not null
Also you would have to requires the Field('ticket',...,unique=True) because
this method it not thread safe and you should be prepared that inserts may
fail.
On Tuesday, 10 November 2015 11:42:40 UTC-6, Niphlod wrote:
>
> if you want to have a number that strictly:
>
> - is incremental (no
if you want to have a number that strictly:
- is incremental (no gaps, always sequential, etc)
- the first two digits are the year
I'd suggest to have a "last_tickets" table (year(int) , ticket_no(int))
holding the current ticket.
then, you can use _before_insert callback on the
4 matches
Mail list logo