Filter repeating group by year

On my website for my business I have a page where our jobs are broken down quarterly with price, profit, etc for each job. So there are four repeating groups, each with contraints, depending on the date/quarter. then each one has a total for that quarter, then at the bottom there is a yearly total. All of it works great, but I want to have a year selection dropdown that will let me look at previous years. For example, I select 2022 in the drop down, then all the jobs from that year are now in my repeating groups instead of the ones for the current year. I thought this would be a pretty simple thing to set up, but nothing I’ve tried has worked

This might help.

You want to calculate the start and end date of the year the user selects.

The example I have here is:

First, I have a dropdown which is populated with years:

I have two fields.

The first shows you how to calculate the start of the year the user selected:

The second shows you how to calculate the END of the year the user selected (actually it’s the first date of the next year but you can just do a “less than” search to find dates less than this end-of-year date:

This gives you:

The end-of-year date I show you is probably the one you want to use. If you subtract a day from this, it will give you 1993-12-31 12:00 am, which IS the last date of the year but won’t show you activity that occurred during that date (for example, someone does something 12:31 at 9 in the morning).

Hope this helps.

Thank you, but I’m struggling more with how to filter what is shown in the repeating groups. I made a drop down that has years to select. I thought in constraints in the repeating group I could make it only show jobs that the year it’s completed(I have it save as the full date) is equal the year selected in the drop down, but I couldn’t get it to work I think mostly because I can’t get it to save the date in the data base as just the year for the constraint to work. Then I tried to “extract” just the year from the date, but it wouldn’t let me do that in constrains

Try this maybe.

Use a Filter in your repeating group.

Add a filter to your repeating group, where the date you’re checking is >= your_calculated_start_date and the date you’re checking < your_calculated_end_date (just replace the calculated values with the formulas I gave you).

Set your dropdown to equal the current year.

So when the page opens, it will automatically just show this year’s transactions because it’s going to use the default value of your dropdown (the current year) to calculate your start and end dates.

If they select a different year, the filter will automatically re-calculate the start and end dates using the new year from the dropdown.

It worked! Thank you so much


Glad to help.

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