How to delete all records


#1

Hi All. I’m playing with the Data Tools section and want to have a button that clears the table i.e. deletes all the records. I can do it using a loop but wonder if there’s a shorter way.


#2

Hi @dsawyer,

I’m not sure exactly what you’re referring to, but it sounds like you’re talking about App Lab, and that using the green Data blocks, you’ve created a table with multiple records, and you want to delete all the records all at once instead of repeatedly using the “deleteRecord” command and deleting one at a time.

Assuming that’s the case, I don’t believe there’s a way. I’ll check with code.org staff and if that’s not the case, I or a code.org staff member will post an update here.

Frank


#3

​Hi,

Sorry for not being clearer. Yes, I’m in App Lab and using the green Data blocks and want to delete all the records at once. I was able to figure out how to do it using a loop but it felt a little clumsy. Is there a way to use SQL commands with the table?

Don Sawyer

Computer Science and Mathematics Teacher

MHS Robotics Club Sponsor

Methacton High School


#4

Hi Don,

I’ll ask internally – I could have sworn that there was a syntax you could use with a wildcard character, or just an empty object, to delete everything but I guess not. I also have a recollection that there were security/stability issues with doing that potentially.

So yeah, you gotta loop it. Only way I found right now.

–Baker
CSP Team