Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

Reset Auto Number

Post Reply
mobilemcclintic
Posts: 54
Joined: Fri Oct 23, 2015 12:34 am

Reset Auto Number

Unread post by mobilemcclintic »

Is there a way to rest the auto number function?
I built and tested a form and now would like it to start again at 1.
I tried deleting the rows from the autonumber table, but that didn't help.
mobilemcclintic
Posts: 54
Joined: Fri Oct 23, 2015 12:34 am

Re: Reset Auto Number

Unread post by mobilemcclintic »

Thank you for reading.
I reset this by running a query in HeidiSQL
alter table auto_xxx_xxxx AUTO_INCREMENT=1

My other question has a related thread around here somewhere.
mobilemcclintic
Posts: 54
Joined: Fri Oct 23, 2015 12:34 am

Re: Reset Auto Number

Unread post by mobilemcclintic »

I thought I could use the live demo to get a code to pick a new auto number only when saving a new record, but it looks like the invoice in the demo pulls a new number when creating a new invoice.
This behavior allows you to create an invoice, not save, go back, and create another one, skipping an incremented number.
I am hoping to only pull a new number when the record is saved.
I am trying to do it in custom code / before save.
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: Reset Auto Number

Unread post by admin »

mobilemcclintic,

Try doing it After Save because Before Save won't have a new Primary Key assigned (#RECORD_ID#)

Steven
Post Reply