Reset data collection each day

Hi ! i am new in here, probably like 2 - 3 Weeks learning make apk with blocks

i have created an app that work for reporting data like sales or performance per day.
it works with Gdrive, everything data submitted, go through GDrive. and its working beautifully fine.

The problem i want to ask, how to reset sales that reported today, because i used TinyDB to only show data that reported today in app.

and it always show total reports even its already been weeks, i know becaused i call TinyDB.

what i want is, the data showed got resetted automatically per day.
if i report today 2, tomorrow should be resetted to 0 again.

How to make automatically reset per day it self ?

i think it work with clock elements logic, but really, i got no idea to start with.

i want to post to ask this question, but i search first and it come to this thread, is it possible to use your extension to solve my question ?

Have any idea where i have to start with ?
Would you please help me?

pardon me and please let me know if i wrong place to ask.

Thank you ! :pray::pray:

You are right, this can be done with a clock component. What you might want to do is every time you collect a piece of data, store the value for the day of the week in the tinyDB (1=Sunday to 7=Saturday) and then have a clock that retrieves that value and checks it with the current day of the week. If it does not match up, it clears the tinyDB. An example of this code is attached

EDIT: this is only an example of the code that retrieves and checks the stored day
you have to integrate into your current code a store variable block that stores the day along with your data