How to do calculations in advanced filter?

Hey guys,
I’m trying to do calculations in advanced filter as i need to convert hours to minutes but i can’t seem to add anything after extracting the hour. I’m only trying to multiply it by 60. Is there a better way to do this?

Try writing the expression the other way around… i.e. Parent group's Venue's Open Hours: filtered: first item's Opening Hour: extract hour x 60 < current date/time: extract hour

or, better still, just turn on the ‘expression parentheses’ experimental feature in your app… then you can write the expression exactly as you have, just with parentheses… i.e. Current date/time: extract hour > (Parent group's Venue's Open Hours: filtered: first item's Opening Hour: extract hour x 60)

The filter is only to determine which data you want to show.

It doesn’t make sense to get a Current date (extract hour) and filter it by a minute… it won’t work as planned. (you will filter an hour like 1, 2, 3, 4, 5, and asking it to be bigger than a 60, 120, 180… it will never work)

If you want to only SHOW the data in minutes, you should filter by Current date:extract hour>… :extract hour, as you have…

and then in the CELL you but a condition with → Parent’s group’s Venue’s Open hours…:first item’s date: format as (put here what you want)

1 Like

Thank you, that helped allow me to do it, now just working on the correct syntax for the filter.

I have a datatype that converts hours to minutes for open/closing times. All im doing with this filter is checking that the users current time (converted to minutes; Extract hour * 60) is within the already converted minutes of the open time.

So this filter is just intended to show which places are open relevant to the time (minutes) comparison.

The extract hour doesn’t work very well as you can’t do 30 minute intervals.

Although, on second look… as @ri_scc_94 points out, that condition doesn’t make any sense…

You’re comparing 2 numbers… the first one being the current time’s Hour (which can only be a number between 0 and 23), to another time’s hour multiplied by 60 (meaning a number between 0 and 1380)…

So the first number will only ever be bigger then the second, when the first time is anything after 1am, and the second time is before 1am…

Sorry i should have clarified that is not how the syntax actually looks. That was just testing something. Here is what the actual syntax looks like:

1 Like

Ah, fair enough…

That’s good to hear it works!

By the way, If I were you, I would try to change the way it runs… your filter looks like it will be very slow depending on the size of your database.

Any :filter is much slower than a serch directly inside the database, and advanced filters are slower yet.

Do you know of anyway that i can constrain a search results without using filters or advanced filters? There doesn’t seem to be a way to do it. Here’s the search on the explore page to return a list of venues:


maybe you could work on the way the “open hours” are stored, for I can see, you have to do many things just to get the hour…
Sometimes it’s good to have it stored directly on the data (ex: 1 hour min and 1 hour max), and update this whenever a user changes the hour (what i think won’t be so often)… but then on search it will be faster

Here’s my datatype. I’ve captured everything I need into it. The problem is that the filtering you see above is to filter the correct day so it doesn’t return open hours for the wrong day. Do you perhaps know of a way to do this without filtering?



Hey mate, just following up on this.

Cool, tell me if it works :slight_smile:

It works, i’m just wondering if you know a more efficient way to do it?

I tried to get a better solution but I couldn’t :confused:
The problem is that you want to let open for the venue to custumize any opening hour and etc.
Try it out, if the search is fast, so it won’t have a problem…

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