Issue with continous incrementing of unbroken sequence for a entire working day

Morten Engvoldsen mortenengv at gmail.com
Thu Feb 28 11:31:58 EST 2013


Hi team,
I need to run a batch of sales records and  the batch has serial_number
filed to store the serial number of the sales record. The serial number
should be set to  1 everyday when the batch runs first time in a day and
the maximum serial number could be 1000.

So when the batch runs first time in a day and if it has 10 records, so the
last serial number will be 10. And when the batch runs 2nd time in same
day, the serial number should start from 11.  In this way serial_number
will increment as an unbroken series throughout the entire working day. The
next day when the batch runs first time the serial number will reset to 1.

Now this could be sample code how the program can count the sequence for a
batch:

def salesrecord():
    serial_number = 1
    for i in selesrecord:
        print first_sales_record
        serial_number += 1
        print serial_number

salesrecord()

So if the batch has 10 records and last serial number of first batch is 10,
then when the batch runs second time in the same day, how the
'serial_number' will get the value of 10 and then continue the serial
number for the same day,  then for next day again the serial number will
start from 1.

Can you let me know how can i achive this in python? As i am in learning
phase of python, can you let me know what would be good approach to do this
in python.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130228/c362d35b/attachment.html>


More information about the Python-list mailing list