AppDB Error Handling


Good day to all.


Developing an app using the serverless technology, I've encountered a minor roadblock.

My dataset needs to have an ID column to use it as TransactionID, that is, on every submit I make to the database, it will work as an auto increment index on those fields (1 to N). Next call to the DOM and eventual submit, it will search the last ID and add 1 to it. 


Ok the logic is all set up, but the help I need is in this:

On the first run, there is still no dataset created as there is no data submited. Thus, I need to evaluate if:

-Dataset is created, so I set up my ID to 1

-Dataset is created AND there is data in it, so I can search the max ID and add 1 to it in the createPost function


I hope I explained myself enough for someone here to help me. Any guidance is appreciated.

Let me know if you need further explanations.



Thanks in advance, have a great day.



This discussion has been closed.