Filtering a repeating group based on date range

Hi,

I’m trying to filter the contents of a repeating group using buttons date ranges. This is similar to another topic but that doesn’t go to the level of using date functions.

Can anyone provide a rough approach I can take?

Thanks,
Andrew

1 Like

Hey Andrew, I just tried doing this with a repeating group and using custom states. I’m not sure if this is the best way (I didn’t use the Date Range features - only Date data types), but here is an example I made in the forum app:

Preview:

Editor:

In this example, I created a new data type called “Stored Dates”. Each Stored Date has two fields: “Date Title” (Type: Text, List: No) and “Starting Date” (Type: Date, List: No). Here’s what those entries look like in App Data:

I then used the Data Type “Color” as the type of content for my repeating group (though this could be anything of course). Within Color, are the “Color Name” and “Date” fields I created to make sure the results were filtered correctly.

Colors displayed in the results depends upon the custom state “Current View” of the Repeating Group. That state is changed based upon which button was most recently clicked. For example, when the “This Month Button” is clicked, the workflow sets the state:

Then in the conditional formatting of the repeating group, I created the following condition:

I then repeated that process for each Custom State value. In this example, the results shown in the repeating group will be Colors whose date is greater than this Stored Date’s Starting Date. The exceptions would be Last Month, Last Week and Last Year which need to have two constraints (since those time periods are between Dates, not just after a Date).

Since it’s a search that could return multiple results, we have to select first Item (though there is only one result).

I was thinking that this could work if you changed those Stored Dates manually (not ideal), or set up API workflow which would modify the Stored Date values to what you need them to be.

If anyone knows a better solution to this please feel free to edit the forum example I made. :slight_smile:

8 Likes

Thank you Faye for taking such effort to share this! Busy working through it!

3 Likes

No problem at all Andrew! :blush: Let me know if I can help!

has anyone discovered a less complex way to do this?

@fayewatson - v.detailed answer - thanks for sharing.

1 Like

I have found that by using two time pickers and two constraints: created date > time picker 1’s value and created date < time picker 2’s value, you can successfully filter with date range.
I have attached a screenshot below.

2 Likes

Thank you! :upside_down_face: