Hello everyone!
I’m developing a system in Bubble to manage client invoices for a gym. Each invoice can have one of the following dynamic statuses: Paid, Pending (in a grace period), or Overdue.
Problem:
I have a Multi-Select Dropdown that allows the user to select one or more statuses to filter the displayed invoices. However, the real status of each invoice depends on date-based logic. I can’t simply filter by a text status (e.g., “Paid” or “Pending”) because the correct status relies on the conditions below:
- Paid: The invoice is considered “Paid” if the due date is in the future (i.e., the current date is before the due date).
- Pending: The invoice is considered “Pending” if the due date has passed but the invoice is still within a 5-day grace period after the due date.
- Overdue: The invoice is considered “Overdue” if it has exceeded the 5-day grace period after the due date and remains unpaid.
The challenge is that the Multi-Select Dropdown can’t simply apply a static filter based on the status name, as the statuses are dynamic and depend on date conditions.
Example of the Issue:
If I want to filter for only “Paid” invoices, the system needs to check if the current date is before the due date for each invoice. If I want “Pending”, it needs to check if the invoice is within the grace period (up to 5 days after the due date), and so forth.
Question:
How can I set up an advanced filter in Bubble that applies date-based logic to determine the actual status of each invoice before comparing it to the selected value in the Multi-Select Dropdown? In other words, I need the filter to account for date and grace period conditions to return only invoices that genuinely match the chosen status.
Any guidance on how to implement this filtering logic correctly in Bubble would be greatly appreciated!
Thank you in advance for the help!
To better understand, to be paid or pending or late: you must follow this line of reasoning that I created to identify the status: