Add New Record from Form does not correctly create next Auto Increment ID

Starting to use scriptcase with a sample MySQL database. Have a table with approx 28K rows and have and ID field which is auto-increment.

If I use SQL browser to insert new record the next ID field is correctly generated but if I use Add New from form the ID field is always set to 0.

Any clues?

Do you have set the field in the field settings as autoincrement? Besides that, if you insert new record in scriptcase which is not stored in the database yet, then the keyfield will not contain the next index number. MySQL will generate that on commit. So you need ot apply the update first.

Many thanks Albert, guided me through solution with your feedback. I’m starting to love ScriptCase!

What to do if I want the id to appear before comit?

Then you should think about your database design … Please explain, why you want the id before commit. At least this is uncommon and is usually a design problem.

My customer gets a code with year + his serial number, … so wanted it to appear on the form … But have already managed to do it with onLoad.

Thanks for advice.