What I’m trying to do:
I am trying to create a table that automatically increment every time the user submit a form to keep track of the submissions.
What I’ve tried and what’s not working:
I tried using the following codes. But found that when 2 people submit at the same time, the IDs are the same. What should I do to avoid this? Thanks.
Code Sample:
max_value = app_tables.id.search(tables.order_by("ID", ascending=False))[0]['ID']
#print(int(app_tables.id.search()[0]))
#print(app_tables.id.search(tables.order_by("ID")))
self.ID=max_value+1
app_tables.id.add_row(ID=self.ID)
Clone link:
share a copy of your app