May 27, 2020 03:39 AM
I’m trying to list all records using the Airtable API that have been updated in the last 24 hours. This job will run each day and check for the last modified column and if the date `IS_AFTER(TODAY()-1 DAY, TODAY()).
I’m struggling with the syntax. Does anyone have any guidance on this?
Solved! Go to Solution.
May 27, 2020 03:54 AM
Hey - I can help you with the syntax - but I just wanted to say that i’ve found best practice to actually be to create a field for last updated (choose the fields you want to trigger on too) and then create a view for all the records that have been updated in the past 24 hours. You can actually just send a request with this view instead of using the formula.
Here’s the formula I think you need, though if you’d prefer to use that method :slightly_smiling_face:
IS_AFTER({Last Update [Zap]}, (DATEADD(TODAY(), -1, 'days')))
May 27, 2020 03:54 AM
Hey - I can help you with the syntax - but I just wanted to say that i’ve found best practice to actually be to create a field for last updated (choose the fields you want to trigger on too) and then create a view for all the records that have been updated in the past 24 hours. You can actually just send a request with this view instead of using the formula.
Here’s the formula I think you need, though if you’d prefer to use that method :slightly_smiling_face:
IS_AFTER({Last Update [Zap]}, (DATEADD(TODAY(), -1, 'days')))
May 27, 2020 05:59 AM
Thanks! Wondering how the syntax you mentioned works. What is the {Last Update [Zap]} part? Is that the column name?
May 27, 2020 06:12 AM
Oh! Yeah - That’s whatever column name you’re using with the last updated field type
May 27, 2020 08:13 AM
In your formula, you are trying to subtract a day but your method of subtracting one date is problematic.
IS_AFTER(TODAY()-1 DAY, TODAY())
To add a day to a date, you need to use DATEADD()
.
However, since you are comparing dates, I recommend using the DATETIME_DIFF()
function instead. Just be careful with the order of your dates, as the order of the dates determines if you get a positive or negative difference
Both of these functions are documented in the formula field reference.
If this answers your question, please mark this post as the solution. Otherwise, could you please give a bit more details and a screen capture?