Adding a row for each day between two dates

Hi all

I’m curious if this is possible.

We do track our work times with AppSheet. Employees enter a Start Timestamp and End Timestamp to track how long they worked for a project in a day.

Now, if they have holidays, they need to add each holiday day seperatly.

Is it possible to create a form, where an employee chooses a start and enddate, and AppSheet adds a row for each day (except weekends) to a table?

Thanks in advance.
Adrian

I believe that is technically possible now with the AppSheet automation feature. You could create a daily Schdule Bot to run say every day at 1:00 AM that adds new records for all those tasks where the bot runs where the day of run is greater than or equal to [Start Date] and less than or equal to [End Date]. So the bot would add new records on a daily basis for all open tasks rather than adding all records at once till the end of the respective task.

So the schedule bot runs a process of Run a Task → Change Data – > Add New Rows.

While creating the first task first time, the employee could define start and end dates. And the daily bot will copy certain fields ( Say task name and description, the project name etc) to create a new row each day.

However, @prithpal or someone from the AppSheet automation team or other community colleagues may opine on the suitability of adding a high number of rows on a daily basis this way using automation. I tested have the concept wherein I conditionally add around 3 or 4 rows. Also, I ran the schedule bot in test mode as my test app was not deployed.

3 Likes

Tricks from @Steve with some alternation to add condition to determine if or not weekdays could achieve a goal?

2 Likes

Thanks a lot for your solution and sorry for replying so late.

So I just tried out this solution, as it looks like what I need.

Unfortunately, when I enter the dates into the controll table and then click on Action Number 1, the App stops working and doesn’t respond. Is it possible to find out, where the actions are not working correctly?

Thanks in advance.
Adrian

The behavior you describe is typically because part of the configuration was omitted or entered wrong. Please review the entire documented process and ensure it is implemented in its entirety.

1 Like

Yes, tricks from @Steve surely works. If not, something wrong with App Settings.
When the app starts to freeze during set up for such type of looping stuffs, it is a good indication that the actions are in inifinite loop, so the app freezes, based on my past experiences.

2 Likes

Thank you both tsuji and steve.

I tried to rebuild the sample app and now got it to work. I don’t really understand how Steve automated the actions (without having to click on the Action 1 in the app) but that’s not really a problem.

What I now have trouble with is, where and how to check if its a weekday or weekend, and how to not create a row if the day is on a weekend.

Any solutions there?

1 Like

Thanks for the links, altough I know about them. The problem is, where to place the code in the app. Which action to attach it to. Also how the syntax should look like exactly. I’m really not coming from a programmer background, so sorry if those are some rookie questions.

Anyway, I will give it a try and see if I maybe can find this out.