Help

Filter Search By Date Range

Topic Labels: Formulas
5082 6
cancel
Showing results for 
Search instead for 
Did you mean: 
Scott_Heliker
6 - Interface Innovator
6 - Interface Innovator

Trying to create a filter in integromat to search records for between todays date and 10 days in the future.
Can’t figure it out… Just playing around with some basic stuff I am getting weird returns

NOT({Start Date}<‘2017/11/15’)

That returned everything in 2018 and 2019 but did not factor in the month to include records greater than Nov 15 2017 like some that were Nov 25th 2017 and Dec 3 2017

Plan is to use the Date now merge tag in integromat and then date now+10 and bring back everything between today and 10 days from now so we can automate an events newsletter weekly only sending the cooresponding events that are happening in the next 10 days.

Appreciate any help…

6 Replies 6

Your test formula is comparing a datetime value against a string, which is likely why you’re getting unpredictable results (frankly I’m surprised it’s even partially working). It’s also more reliable to use Airtable’s IS_BEFORE and IS_AFTER date-comparison functions. Try this instead:

NOT(IS_BEFORE({Start Date}, DATETIME_PARSE("2017/11/15", "YYYY/MM/DD")))

For your actual use case where you’re checking for items within a range of dates, you’d likely want something like this (which you should be able to paste directly into Integromat’s formula field in the Airtable search module, because that’s where I copied it from):

AND(IS_AFTER({Start Date}, {{now}}), IS_BEFORE({Start Date}, {{addDays(now; 10)}}))
Scott_Heliker
6 - Interface Innovator
6 - Interface Innovator

Hey Justin thanks… I got an error because the now was adding the time and seconds to the end so I formatted the date for YYYY-MM-DD… Got rid of that error but have another one for the add days area…

AND(IS_AFTER({Start Date},{{formatDate(now; “YYYY-MM-DD”)}}),IS_BEFORE({Start Date},{{addDays(formatDate(now; “YYYY-MM-DD”; 14) + “))”)}}

Scott_Heliker
6 - Interface Innovator
6 - Interface Innovator

Had the bottom date nesting formula working by itself but not thrown in the mix… Not sure what the hiccup is… Seems to be stripping the + sign also in front of 14

indent ---   AND(IS_AFTER({Start Date},{{formatDate(now; "YYYY-MM-DD")}}),IS_BEFORE({Start Date},{{formatDate(addDays(now; 14); "YYYY-MM-DD")}})

You don’t want to use Integromat’s formatDate function. That turns the date back into text. It needs to stay as a date for the IS_BEFORE and IS_AFTER functions to operate properly.

I don’t think that time and seconds have any bearing on it. It’s actually my own fault for not actually testing that earlier formula before I passed it along. I somehow overlooked the fact that even though Integromat would translate its now variable into a datetime object for its own use, it needs to be passed into Airtable for formula execution, so it becomes a string, which has to be parsed before Airtable can compare the dates. Here’s a formula that has been tested:

AND(
    IS_AFTER(
        {Start Date},
        DATETIME_PARSE("{{now}}")
    ),
    IS_BEFORE(
        {Start Date},
        DATETIME_PARSE("{{addDays(now; 14)}}")
    )
)

Just as multi-line functions work in Airtable, this will work as-is in Integromat.

Beautiful… Thank you for your help Justin. Works great!!
Easier to decipher when broken up like that also…

Just chiming in to say thanks for this solution, Justin! I really appreciate it!