I’ve created a code in App Lab that asks for your weight and the date. When I reset the program and run it again all of the data is still there from the previous runs. Is there a way clear the record or start the id back at 1?
It is a good practice not to assume what the id is going to be even if you could reset it. Always assume they are not sequential and you don’t know where they start.
You can delete all the records by going into data view and click clear table.
I haven’t used the data feature much, and as I was playing around with it, I see what @jdonwells meant by saying not to assume the ids! Even after reloading the page, the app seems to generate ids from where it left off (and I’d agree with jdonwells to not assume that behavior is consistent).
I was able to modify the “readRecords” loop to delete all table entries as an attempt to clear the table from within the app, but that’s about as close as I could get. Not sure if that’s good practice as I’m only dabbling in this.
I suspect the database has no clear command by design to avoid accidental clearing. The design team could easily make it so that if there is no id specified it clears everything. My guess is that would cause huge amounts of pain for our students and frantic messages to the support team.
Instead I would wonder if you need the database for that application? If you want a fresh database every time you run then you probably don’t need the database. The database itself is not a robust implementation with many limitations that a fit for purpose data structure could overcome.