I’m developing an app to track daily activities. In the local storage, I will have 6 fields like below.
When an app is opened, I would like the app to look into the database and see if there’s already a record of today’s date. If there is, then there is no need to create a new record.
If there is not, the app has to create a new row of record for today’s date.
If the last time I opened the app was 10:00 PM yesterday (02/13) and I open the app at 8:00 AM today (02/14), I would like to see a new row of record with 2/14/2023 under date with other fields set to 0.
If the last time I opend the app was 8:00 AM today (02/14), and I open it again at 3:00 PM today (02/14), there should already be a record with 2/14/2023, so I don’t need to create a new record.
Here’s my current thought process.
When the app is opened, use the IF Condition to look into the Date field in database to see if there’s a matching record. If there is none, then create a new record with today’s date. If there is a matching record, then don’t create a new record.
I tried to start with IF Condition, but it only allows me work with true/false fields and not with date/time field.
Any suggestions where I can start?