Daily Query and Update on a Glide Table

Hi,

I have a set of tasks in a table in Glide. I used Glide tables for speed, but am wondering whether I should have used Google Sheets now…

Let’s say I have 20 tasks, and 5 of them are marked as “Recurring” using a checkbox when they are added. These will get completed during the day, but I would like them to re-appear tomorrow as uncompleted.

Basically I need the equivalent of a script that runs at say midnight and finds all rows that are Recurring=True and sets Completed=False.

Is this possible in Glide Tables, or do I need to bite the bullet and move my task data into a Google Sheet and use AppScript to achieve the above?

Thanks in advance for any help!

Jonathan

I think you can apply a bit of Glide computed column logic here. Try the following:

  • In your Tasks table, add a Date/time column. Use this column to record the last time a task was completed. So when a user completes a task, use an action to set that column to the current date/time
  • Add an if-then-else column:
    – If Last Completed is within today, then Task Status
    – If Recurring is not checked, then Task Status
  • You can then use your if-then-else column to show the Task Status for the current day (checked = completed, not checked = pending)
1 Like

Hi Darren,

Thanks for your input. I managed to create the column that records the date/time when a task is completed.

I can get the If/Then/Else to detect whether that column is “within” “today” and return a True/False.

I am struggling with how to also check for the Recurring status being checked. I can’t do an AND within the If/Then/Else calculation can I?

Could you expand on your idea to help me understand that part I am not understanding?

Thanks.

What exactly isn’t working with @Darren_Murphy’s solution? You can add multiple checks within an IF column. Can you show a screenshot of the IF column configuration? The way I’m understanding, it should work. If the task was completed today then it’s a completed task, so the status should be completed. If not, then it checks if the recurring is checked. If it’s not checked, then it’s a one-off task and should return true. Otherwise, the completed date is not today AND recurring is checked, so it should fall into the ELSE statement where you can return false.

2 Likes

Just revisiting this, I think we need one more condition added to the IF column to account for empty task dates.

– If Last Completed is within today, then true
– If Last Completed is empty, then false
– If Recurring is not checked, then true
– Else false

@Darren_Murphy correct me if I’m wrong.

1 Like

I was working on the assumption that there is an existing boolean column that indicates task status, so I used that in the if-then-else logic. So instead of returning true/false, my logic returns the state of that column (or not). It seems to work… :thinking:

In the above example:

  • Task 1 was last completed yesterday, but as it isn’t recurring the if-then-else returns true
  • Task 2 was last completed 2 days ago and Task 3 yesterday. As they are both recurring and neither has been completed Today, both return null
  • I don’t bother with an explicit false return, as it’s not really needed

I guess the thing about the above is the boolean “Completed” column is basically redundant, so it would make sense to get rid of that.

1 Like

Got it. That makes sense.

1 Like

Hi Jeff and Darren,

Thanks for assisting me. I am new to Glide and still trying to get my head round how some of the functions work.

Maybe it would be clearer if I give you a specific example of what I am trying to achieve.

If you can imagine we are looking at this as at 26 April 2023, 9:00 and I have a screen that shows my Task List that are not completed. I rely on the Completed column as a filter for this purpose.

If a task is “Recurring” and has been completed yesterday (or earlier if you haven’t accessed the app over the weekend for example) then I want it to change its “Completed” value back to FALSE if it is TRUE.

Is there any way to do this with the If->then->else function, or would I have to rely on AppScript and do this within a Google Sheet if I need it to directly update that Completed value based on the above criteria? Or is there another way that I haven’t thought of!

In pure logic terms, I need this:

If (Recurring is TRUE)
AND (Last Completed date is before today)
SET (Completed to FALSE).

Jonathan

What I would do is get rid of the Completed boolean column, and replace it with an if-then-else column, configured along the lines that Jeff suggested. That is:

  • If Last Completed is within Today, then true
  • If Last Completed is empty, then null
  • If Recurring is not checked, then true

Here is how that would look with your sample data:

And here is how the if-then-else column would look:

One important point is that when you use that column as a filter, do not test for true/false. Instead test for is checked/is not checked.

2 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Hi Darren,

Thanks, I think this works now. I am implementing it on my app and will see for sure tomorrow when hopefully my recurring task will reappear on my list as incomplete :slight_smile:

I am updating my filter to use ifCompleted instead of Completed and will rely on the fact that the Last Completed value is populated instead of the boolean for Completed to confirm a task as “Completed”.

Have you published any apps on Glide that you have people pay for? I am wondering whether I can use Glide for this or whether it will only be just for my prototype. I would like to charge people to use the app maybe as a subscription or a one off payment, but I need to implement some sort of robust way of connecting to a user’s calendar to get part of the app to work (it brings in the next calendar appointment onto the top of the task list in my app).

Jonathan

You could publish your App as a template in the Glide Template store, see below:

1 Like

Thanks. I will consider doing that. Thanks for all your help so far :slight_smile: