I want to have a numbering system which is 2 digit year, 2 digit month and 
then an autoincrement number which resets each month. 1703#####

Currently using SQLite with a view to move to MYSQL in future. The MYSQL 
examples I have found suggest using a composite primary key, which doesn't 
seem to fit too well with web2py.

The reason I am trying for autoincrement is so the database ensures the 
numbers are unique. I am willing to look at another way if I am sure I 
won't end up with 2 identical numbers.

At the moment I have it working with datetime.date.today().strftime('%y%m') 
+ id. So I am half way there, but can't see how to reset each month. I 
guess I can check for the highest number in the database programmatically, 
but I am worried about duplicate numbers with a high number of users. This 
also seems like if the document with the highest number was deleted (but 
possibly already printed), then the number will be reused.

The program uses the actual primary key for all backend work. This is just 
an identifier for humans, but the documents produced by the program can't 
afford to have the same number as another document.

Can someone give me a nudge in the right direction, I am a bit stuck?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to