Filter search to last 30 days?

I want to show invoices which have been paid in the last 30 days but can’t see how to limit the search to just 30 days?

Paid date ≥ Current date/time +(days) -30

You might want to round that down to day as well.

4 Likes

Thank you @adamhholmes that did the trick! It actually failed when I rounded down to day but seems OK without the round down.

Sorry to ask another, but how can I show the Paid date for an invoice? The following show nothing…?

What you’ve got there is correct…

So if nothing is showing then there’s either nothing in the database (no data for the given Invoice’s paid date) or perhaps privacy rules re preventing it from being displayed. Check in the debugger to see what the issue is.

There is data in the database so I’m not sure why it’s not working. I can’t do a debugger because there are no workflow steps to debug, although I have never used the debugger so actually I am unsure how to do it.

As for privacy, I don’t really understand this either, for example the ‘Plan’ and Subscription Status’ is marked as hidden in Privacy (see below) but the User clearly sees both the ‘Plan’ and Subscription Status’ when they are logged in so I am not sure what Privacy actually achieves?

Similarly, Privacy for Invoice Item show all fields unchecked but it makes no difference, User can see all those fields whether checked or not.

You don’t need to have any workflows to use the debugger - just use the inspector…

If you don’t know how to use the debugger then I suggest you spend some time learning, as it’s usually the quickest way to figure out your mistakes and see what you’re doing wrong, as well as to identify genuine bugs, and overall is a very important part of getting your apps to work as you want them to.

The Bubble manual is the best place to learn: Using The Debugger - Bubble Docs

Regarding your question about why the data isn’t showing, if you’re certain there is a valid Paid Date in the database entry for the specific Invoice item you’re trying to display (and there are no privacy rules preventing access to the data) then something’s obviously wrong.

So use the debugger to check the data in the parent group (you don’t need any workflows - just use the inspector) - if the parent group’s Invoice is empty then you must be defining the group’s datasource incorrectly. If it’s not empty then clearly the Item in question doesn’t have any data for it’s Paid Date field (or it’s restricted by privacy rules).

Regarding your question about Privacy rules…

In that pic you’re setting rules for Autobinding… so the current User will NOT be able to make changes to the Plan or Subscription Status fields using autobinding - nothing to do with what the User can or can’t see.

For setting which fields can be viewed you need to uncheck the ‘View All Fields’ box, then set the permissions for each individual field.

Again, in this pic you’re showing that you have certain fields allowed for autobinding, but EVERYONE can view ALL fields.

If you don’t understand the basics of setting and using privacy rules, again the Bubble manual is the best place to begin: Privacy - Bubble Docs

Wow thank you for the detailed response, you’re such a great help mate. Ok, I see I was setting rules for Autobinding (not what the User can see) so that makes sense now, thanks.

You’ve given me some good homework regards debugging etc so I will go through all this and see if I can find why the invoice Paid date isn’t showing. Thanks again!

1 Like

I have done some debugging and found the reason the Paid date wasn’t showing for an invoice - it’s a little embarrassing because I should have known!

Basically I wasn’t sending the date information to the DB when an invoice was marked as Paid (for some reason I thought that would be recorded automatically by Bubble). So, I added a field to the DB called ‘Status-change-date’ and when a User marks as Paid I send the Current Date to the DB, I can now refer to that and show the date.

1 Like