I’m trying to display bills based on the month the user selects. I have created a state that displays the month and year like this: December 2023.
Then I created a repeating group that displays all bills, and I’m trying to filter out the ones that are not in the currently selected month. But it’s not working. Can anyone tell me what I am doing wrong? Thanks
‘Due Date’ is a specific date. ‘Current Month’ is (I assume) a date rounded down to the month (eg 1st Oct 2024 12:00 am).
The two can only be equal if the due date is on the first of the month.
To do what you are trying to do, you will have remove the search constraint that uses ‘=’ and use two search constraints instead:
Constraint 1 Due date ≥ Text Current Month’s currentmonth
Constraint 2 Due date < Text Current Month’s currentmonth+months:1
This will return all bills that have a due date greater than or equal to the first of the selected month, but also less than the first of the next month.
@Daniel90 as time goes by you’ll end up with issues because of different years.
Add data fields for the month as a number and the year as a number…then use the constraints of a search to first extract from selected dates the month and year and use those to match against constraints for the month and year data fields
That didn’t work. As you can see in the screenshot, it shows bills from December and January. If I change the date from December to January, it shows bills from February.
January 1 - January 31 2023 filtering by month range will return results for January 1 - January 31 2022 as well as every other year that has data in the system.
@Daniel90 add in the data fields I mentioned, then on your search constraints look at your date you have at the top in blue (December 2023) use that DATE and use the function of extract month and extract year within the search constraints to match against the data field for month and year as I mentioned.
Sorry you are correct. I was thinking in lines of a repeating group for months to show the number of bills for that month. Your approach for this use case works just fine to have only one month (ie: date) selected to filter off.