Making ID unique and auto-increment type on each entry to database

My table has a field ID. I want to make it auto-increment type and unique always. The new entries are made through the android app. So, how can this be done ??

Add a “before” event handler for the “create” event. In the handler use Atomic Counter API to increment and get a value. Assign the value from the counter to your object.

Hi Mark.

I added a “before” event handler for one of Data Table. I have also donloaded the generated code. CodeRunner works but I don’t know exactly which files to include in …/classes? I have watched https://www.youtube.com/watch?v=aFI4zqEcXtw video but its about service and I want to create a event handler and implement “Auto increment Api”.

Try to investigate
https://backendless.com/documentation/business-logic/java/bl_data_service_handler.htm

After you wrote a code, you should just build it and then run coderunner.

Thnx for replying… I’ve achieved it.