Search constraint based on day of week

I have a data type that stores a date.

I would like to run a search through this data type that returns only things where the date is a Saturday or a Sunday, but I can’t seem to do this as all constraints start with X (operator) Y and I don’t have the option to search X:formatted as (#) (operator) Y.

Do I really need to calculate the day of the week when the thing is created and store that as its own field and instead filter using that?

Hi there, @georgecollier… you can use an advanced filter to do what you described, and the filter would look like this.

As you may or may not know, advanced filters happen on the client (browser) side, so performance could take a hit, depending on how many items are returned from the search. If you were storing the day of the week when the thing is created, you could avoid the advanced filter by merging two searches together (one with a constraint where the day is Saturday and one with a constraint where the day is Sunday), so that’s one reason you might want to consider going that route.

Hope this helps.


1 Like

Hey Mike,

Thanks for your quick reply, but this won’t work for mine. I should’ve been more specific in my use case!

Essentially I have a sort of booking app. I have a repeating group of users and I am displaying the duration of time that each user has booked in the last X days on weekends. See below:

For weekend hours, I run a search for bookings by current cell’s user where the date > current date -30/90/365 etc.

Seems like storing the day of the week/having an isWeekend yes/no field will be the best approach.

1 Like

Sorry I missed the mark there, but if your reply had been your initial post, my reply wouldn’t have been what it was. :slight_smile:

I am never averse to storing an extra field or two to get what I need out of the data, so for what it’s worth, I would likely go that route, too.

1 Like

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