Overdue tasks automatically tagged

Trying to automatically update the number of days a task is overdue.

Here’s what I have:

I created a workflow that is triggered on page loading:

On this screenshot, where it says “0”, it’s supposed to display the # of days overdue:

I also tried just creating a button with the same workflow to try this manually but it didn’t work either:

Can someone help me figure this out?

What date ranges are you using? It could be that 12/10 and 12/09 are below 1 day, so it would show 0. Can you try a larger date range?

1 Like

Great shout Talbot, it may be as simple as that @ryan10

Try either extending the spread between the task due date and current date time (by shifting the due date further back, unless of course you have a time machine and can change the current date/time). Make sure the Task due date is a few days before the Current Date/Time and then it should show that.

Remember, :format as days is a rounding operator, so it’s rounding up or down and in this case it may be rounding down to zero.

Thanks for the reply, I did this just 30 minutes ago so the date range should be large enough.

Also, it doesn’t update the overdue field at all, for the two tasks you see I had just set the default for “days overdue” to 0 and then changed to to “days overdue = blank” when a new task is created.

You haven’t shown us what it is you’re displaying in your RG, so we can’t definitively say what you’ve done wrong in terms of displaying field “Days overdue”. You’re likely just displaying the wrong thing, or your expression you’re using there is wrong. (It is also possible that your workflow that sets the “days overdue” field is not set up right.)

Note that what you are storing in your database as “Days overdue” is a text – it is not a number, nor a date and is of very limited use.

But first: Why would you need to do this? You don’t need to store this value in your database as, from a display perspective, you always know when a task is overdue.

Three things to know:

  1. A task is overdue if its due date is earlier than the current date/time. The state of a task being “overdue” is a derived value.

  2. Similarly, the amount of “overdueness” is also a derived value that you can always know. (And that amount of time can be visualized as the Task's due date - Current date/time:formatted as... (some interval). )

  3. Note: The measure of a task’s overdueness (due date - current time) cannot be used to determine if a task is overdue. This is because that measure is not a number, it is a complex data type that Bubble calls a “date interval”. (This may sound strange, but it is true. More about this complex data type below.)

Getting the database involved here just slows things down for no good reason. Don’t do that.

Secondly: Even if you did have a reason to store this value (of “overdueness”), why would you store it as text? It’s just not very helpful.

[EDIT: :point_up_2: OP confirms storing this value as a number. And, indeed, :format as (interval) returns a number (not a text)… but I swear I’ve seen it return strings at times… hmmm…]

Now: How do we achieve what you want properly? And what about note #3 above (date intervals… what are they)?

Let’s tackle that backward: First, the **date interval** data type is somewhat strange. It’s not in fact intended to be stored in the database, even though that is a thing you can do. It is a data type intended to help us display amounts of time expressed in various time units. It’s a time range formatting thing, if you will.

It’s something that you use in a text field, not something that you are supposed to store. (This is not obvious and you can be forgiven for not knowing this as this is not well documented and this property is unique amongst the various Bubble data types.)

What we do store in our database is dates (or things like date ranges) and, from any two dates, when we display them, we can format them as a duration between the two dates (by way of the “date interval” data type).

I can share more about how you actually use this in your use case later…

Thanks, Keith. This is all great info.

I’d like to provide some additional info based on your response.

  1. As for why I need this, I’d like to be able to automatically highlight/sort tasks that are “overdue.” I don’t need to actually display the # of days a task is overdue, I’ve just added the text element to the repeating group so I can make sure it’s working correctly. Ultimately what I’d like to do is sort/filter the list based on whether or not days overdue >= 1.

  2. You mentioned that I have “days overdue” stored as a text object, I’m not sure if you’re saying it should be text? Currently, I do have it as a number.

  1. It seems that the issue I’m having is with applying the formula to the entire list of tasks. When I simply create a text field in the repeating group and use the formula in the image below, it works just fine as you can see in the 2nd image below. The top number in the cell is the new text field.

I’d love some more information on the date interval data type you mentioned, looking forward to hearing back.


OK, so on to how we indicate “overdue” tasks in the page rather than storing this value on the task. I show and tell in this talky doofy video:


This is great! Thanks for sending. I’ll update after I watch and play around with my app a bit.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.